3

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

1 Answer 1

4

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");
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.