summaryrefslogtreecommitdiff
path: root/framework/cli/views/webapp/protected/tests/functional
diff options
context:
space:
mode:
authorPatrick Seeger <pseeger@ccwn.org>2012-04-13 23:11:05 +0200
committerPatrick Seeger <pseeger@ccwn.org>2012-04-13 23:11:05 +0200
commit341cc4dd9c53ffbfb863e026dd58549c1082c7a7 (patch)
tree1bbbed20313bafb9b063b6b4d894fe580d8b000f /framework/cli/views/webapp/protected/tests/functional
yii-framework 1.1.10 hinzugefügtHEADmaster
Diffstat (limited to 'framework/cli/views/webapp/protected/tests/functional')
-rw-r--r--framework/cli/views/webapp/protected/tests/functional/SiteTest.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/framework/cli/views/webapp/protected/tests/functional/SiteTest.php b/framework/cli/views/webapp/protected/tests/functional/SiteTest.php
new file mode 100644
index 0000000..cb9727c
--- /dev/null
+++ b/framework/cli/views/webapp/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');
+ }
+}