Here is my environment Yii 1.1.10
, PHPUnit 3.6.0
, Selenium Server 2.20.0
, PHP 5.2.17
Every time i use command $this->assertTextPresent('Foo');
on my Yii application. PHPUnit seem not responding and didn't give feedback. If i removed that assert, PHPunit is working.
How come?
Example of no Responding.
I Tried to test phpunit with SiteTest.php (default test example from Yii)
here is the content of SIteTest.php
<?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');
}
}
And this is the result
seems like phpunit not responding anything. and here is the example if i create my own Test unit without assertion or any test so i will get error.
<?php
Class MessageTest extends CTestCase {
}
?>
and here the result.