【发布时间】:2016-02-02 13:32:41
【问题描述】:
我将测试从 Codeception 2.0.9 更新到 2.1.5。
除了PhpBrowser::grabAttributeFrom() 方法外,一切正常。我会得到一个这样的 PHPUnit 异常:
[PHPUnit_Framework_Exception] DOMDocument::loadXML(): Entity 'nbsp' not defined in Entity, line: 3
或
[PHPUnit_Framework_Exception] DOMDocument::loadXML(): Opening and ending tag mismatch: img line 141 and a in Entity, line: 142
看来,grabAttributeFrom 对 HTML-DOM 解析非常严格。我用谷歌搜索了这条消息,发现DOMDocument::loadHtml() 不那么严格并且可以工作。
http://php.net/manual/en/domdocument.loadhtml.php
如何解决这个grabAttributeFrom?我需要 HTML 文件的 href/src 属性的内容。
【问题讨论】:
-
你能得到堆栈跟踪吗?使用 -vvv 标志运行此测试。
-
是否在同一个套件中启用了 REST 模块?
-
哦。是的,这似乎是这个问题的解决方案。 REST 模块和 PhpBrowser 不再一起工作。 :( 我需要 REST Bundle 在这个测试中检查 HTTP-Headers。
标签: codeception