简体   繁体   English

Phpunit错误 - 断言节点表示失败

[英]Phpunit Error - failed asserting node denoted by

I am using PHPUnit 3.5.x along with Zend 1.10 I have a line in my IndexControllerTestCase.php 我正在使用PHPUnit 3.5.x和Zend 1.10我的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 真的很感激任何帮助

我不是XPath向导,但在我们的测试中,我们使用类似下面的内容来查找带有id message的<div>。

$this->assertXpathContentContains('//div[@id="message"]', "test message");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM