Permalink
Browse files

No commit message

  • Loading branch information...
1 parent 84ac94a commit 84da51853f65217baa96ca921091abee2660dc10 qiang.xue committed Jun 19, 2009
@@ -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->clickAndWait("//input[@value='Submit']");
+ $this->assertTextPresent('Body cannot be blank.');
+ }
+
+ public function testLoginLogout()
+ {
+ $this->open('');
+ // ensure the user is logged out
+ if($this->isTextPresent('Logout'))
+ $this->clickAndWait('link=Logout');
+
+ // test login process, including validation
+ $this->clickAndWait('link=Login');
+ $this->assertElementPresent('name=LoginForm[username]');
+ $this->type('name=LoginForm[username]','demo');
+ $this->clickAndWait("//input[@value='Login']");
+ $this->assertTextPresent('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');
+ $this->assertTextPresent('Login');
+ }
+}
@@ -171,7 +171,7 @@ public function buildFileList($sourceDir, $targetDir, $baseDir='')
$handle=opendir($sourceDir);
while($file=readdir($handle))
{
- if($file==='.' || $file==='..' || $file==='.svn')
+ if($file==='.' || $file==='..' || $file==='.svn' ||$file==='.yii')
continue;
$sourcePath=$sourceDir.DIRECTORY_SEPARATOR.$file;
$targetPath=$targetDir.DIRECTORY_SEPARATOR.$file;
@@ -45,7 +45,7 @@
* means an AR class, while ':Post' means a table name).
* Defaults to false, meaning fixtures will not be used at all.
*/
- public $fixtures=false;
+ protected $fixtures=false;
/**
* PHP magic method.
@@ -30,7 +30,7 @@
* means an AR class, while ':Post' means a table name).
* Defaults to false, meaning fixtures will not be used at all.
*/
- public $fixtures=false;
+ protected $fixtures=false;
/**
* PHP magic method.

0 comments on commit 84da518

Please sign in to comment.