summaryrefslogtreecommitdiff
path: root/protected/tests/functional/SiteTest.php
diff options
context:
space:
mode:
authortzur <tzur@ccwn.org>2012-04-15 15:30:09 +0200
committertzur <tzur@ccwn.org>2012-04-15 15:30:09 +0200
commit5b2095abddf9d0596a7715879357e8d9a3b786b2 (patch)
tree0c2b6fdc1484b697b1a3740582a906fb51c1d64f /protected/tests/functional/SiteTest.php
Initial version
Diffstat (limited to 'protected/tests/functional/SiteTest.php')
-rw-r--r--protected/tests/functional/SiteTest.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/protected/tests/functional/SiteTest.php b/protected/tests/functional/SiteTest.php
new file mode 100644
index 0000000..cb9727c
--- /dev/null
+++ b/protected/tests/functional/SiteTest.php
@@ -0,0 +1,47 @@
+<?php
+
+class SiteTest extends WebTestCase
+{
+ public function testIndex()
+ {
+ $this->open('');
+ $this->assertTextPresent('Welcome');
+ }
+
+ public function testContact()
+ {
+ $this->open('?r=site/contact');
+ $this->assertTextPresent('Contact Us');
+ $this->assertElementPresent('name=ContactForm[name]');
+
+ $this->type('name=ContactForm[name]','tester');
+ $this->type('name=ContactForm[email]','tester@example.com');
+ $this->type('name=ContactForm[subject]','test subject');
+ $this->click("//input[@value='Submit']");
+ $this->waitForTextPresent('Body cannot be blank.');
+ }
+
+ public function testLoginLogout()
+ {
+ $this->open('');
+ // ensure the user is logged out
+ if($this->isTextPresent('Logout'))
+ $this->clickAndWait('link=Logout (demo)');
+
+ // test login process, including validation
+ $this->clickAndWait('link=Login');
+ $this->assertElementPresent('name=LoginForm[username]');
+ $this->type('name=LoginForm[username]','demo');
+ $this->click("//input[@value='Login']");
+ $this->waitForTextPresent('Password cannot be blank.');
+ $this->type('name=LoginForm[password]','demo');
+ $this->clickAndWait("//input[@value='Login']");
+ $this->assertTextNotPresent('Password cannot be blank.');
+ $this->assertTextPresent('Logout');
+
+ // test logout process
+ $this->assertTextNotPresent('Login');
+ $this->clickAndWait('link=Logout (demo)');
+ $this->assertTextPresent('Login');
+ }
+}