Note that there are some explanatory texts on larger screens.

plurals
  1. POYii assertTextPresent not working
    text
    copied!<p>Here is my environment <code>Yii 1.1.10</code>, <code>PHPUnit 3.6.0</code>, <code>Selenium Server 2.20.0</code>, <code>PHP 5.2.17</code></p> <p>Every time i use command <code>$this-&gt;assertTextPresent('Foo');</code> on my Yii application. PHPUnit seem not responding and didn't give feedback. If i removed that assert, PHPunit is working.</p> <p>How come?</p> <hr> <p>Example of no Responding.</p> <p>I Tried to test phpunit with SiteTest.php (default test example from Yii)</p> <p>here is the content of SIteTest.php</p> <pre><code>&lt;?php class SiteTest extends WebTestCase { public function testIndex() { $this-&gt;open(''); $this-&gt;assertTextPresent('Welcome'); } public function testContact() { $this-&gt;open('?r=site/contact'); $this-&gt;assertTextPresent('Contact Us'); $this-&gt;assertElementPresent('name=ContactForm[name]'); $this-&gt;type('name=ContactForm[name]','tester'); $this-&gt;type('name=ContactForm[email]','tester@example.com'); $this-&gt;type('name=ContactForm[subject]','test subject'); $this-&gt;click("//input[@value='Submit']"); $this-&gt;waitForTextPresent('Body cannot be blank.'); } public function testLoginLogout() { $this-&gt;open(''); // ensure the user is logged out if($this-&gt;isTextPresent('Logout')) $this-&gt;clickAndWait('link=Logout (demo)'); // test login process, including validation $this-&gt;clickAndWait('link=Login'); $this-&gt;assertElementPresent('name=LoginForm[username]'); $this-&gt;type('name=LoginForm[username]','demo'); $this-&gt;click("//input[@value='Login']"); $this-&gt;waitForTextPresent('Password cannot be blank.'); $this-&gt;type('name=LoginForm[password]','demo'); $this-&gt;clickAndWait("//input[@value='Login']"); $this-&gt;assertTextNotPresent('Password cannot be blank.'); $this-&gt;assertTextPresent('Logout'); // test logout process $this-&gt;assertTextNotPresent('Login'); $this-&gt;clickAndWait('link=Logout (demo)'); $this-&gt;assertTextPresent('Login'); } } </code></pre> <p>And this is the result</p> <p><img src="https://img.skitch.com/20120301-payijgnhunu3sif1esdfh8grfi.jpg" /></p> <p>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.</p> <pre><code>&lt;?php Class MessageTest extends CTestCase { } ?&gt; </code></pre> <p>and here the result.</p> <p><img src="https://img.skitch.com/20120301-8p1kpnsunn65w64tfgg7848yb9.jpg" /></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload