【问题标题】:Phpunit Error - failed asserting node denoted byPhpunit 错误 - 断言节点失败,由
【发布时间】:2012-01-13 13:18:11
【问题描述】:

我正在使用 PHPUnit 3.5.x 和 Zend 1.10 我的 IndexControllerTestCase.php 中有一行

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

这显示一个错误

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

知道为什么会弹出这个错误吗?任何帮助将不胜感激

【问题讨论】:

    标签: php zend-framework phpunit zend-test


    【解决方案1】:

    我不是 XPath 向导,但在我们的测试中,我们使用类似以下的方法来查找带有 idmessage

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

    【讨论】:

      猜你喜欢
      • 2012-11-28
      • 2019-04-06
      • 2021-10-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-22
      相关资源
      最近更新 更多