I am using PHPUnit 3.5.x along with Zend 1.10 I have a line in my IndexControllerTestCase.php

$this->assertXpathContentContains("id('message')", "test message");

this shows an error

1) IndexControllerTest::testIndexWithMessageAction
Failed asserting node denoted by id CONTAINS content "test message"

C:\xampp\htdocs\hive\library\Zend\Test\PHPUnit\Constraint\DomQuery.php:256
C:\xampp\htdocs\hive\library\Zend\Test\PHPUnit\ControllerTestCase.php:516
C:\xampp\htdocs\testsample\tests\application\controllers\IndexControllerTest.php
:14

Any idea why this error pops up? Any help would really be appreciated

share|improve this question
feedback

1 Answer

up vote 3 down vote accepted

I'm no XPath wizard, but in our tests we use something like the following to look for the <div> with the id of message.

$this->assertXpathContentContains('//div[@id="message"]', "test message");
share|improve this answer
it worked thanks :) – Srivathsa Dec 6 '11 at 10:54
feedback

Your Answer

 
or
required, but never shown
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.