HCE Project DC service web UI  0.2
Hierarchical Cluster Engine DC service web UI
 All Classes Namespaces Files Functions Variables Pages
SiteTest.php
Go to the documentation of this file.
1 <?php
2 
3 class SiteTest extends WebTestCase
4 {
5  public function testIndex()
6  {
7  $this->open('');
8  $this->assertTextPresent('Welcome');
9  }
10 
11  public function testContact()
12  {
13  $this->open('?r=site/contact');
14  $this->assertTextPresent('Contact Us');
15  $this->assertElementPresent('name=ContactForm[name]');
16 
17  $this->type('name=ContactForm[name]','tester');
18  $this->type('name=ContactForm[email]','tester@example.com');
19  $this->type('name=ContactForm[subject]','test subject');
20  $this->click("//input[@value='Submit']");
21  $this->waitForTextPresent('Body cannot be blank.');
22  }
23 
24  public function testLoginLogout()
25  {
26  $this->open('');
27  // ensure the user is logged out
28  if($this->isTextPresent('Logout'))
29  $this->clickAndWait('link=Logout (demo)');
30 
31  // test login process, including validation
32  $this->clickAndWait('link=Login');
33  $this->assertElementPresent('name=LoginForm[username]');
34  $this->type('name=LoginForm[username]','demo');
35  $this->click("//input[@value='Login']");
36  $this->waitForTextPresent('Password cannot be blank.');
37  $this->type('name=LoginForm[password]','demo');
38  $this->clickAndWait("//input[@value='Login']");
39  $this->assertTextNotPresent('Password cannot be blank.');
40  $this->assertTextPresent('Logout');
41 
42  // test logout process
43  $this->assertTextNotPresent('Login');
44  $this->clickAndWait('link=Logout (demo)');
45  $this->assertTextPresent('Login');
46  }
47 }