سؤال

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

هل كانت مفيدة؟

المحلول

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");
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top