I have a controller test case that looks like the following:
class LoginControllerTest extends Zend_Test_PHPUnit_ControllerTestCase
{
public function testLoginFormIsShown()
{
$this->dispatch('/login');
$this->assertQuery('form#login');
}
}
However our site is written using HTML5 and contains elements like <HEADER>, which creates a warning when ZF internally calles DomDocument::loadHtml() on the output:
1) LoginControllerTest::testLoginFormIsShown
DOMDocument::loadHTML(): Tag header invalid in Entity, line: 8
How can I either tell ZF not to pass this error through, or get PHPUnit to not regard the Warning as an error? I don't want to turn down error reporting for the whole test suite.
EDIT:
Adding @expectedException PHPUnit_Framework_Error_Warning to the test method supresses the failure, but hides any subsequent errors (and in fact doesn't even run the query).
EDIT AGAIN:
There doesn't seem to be a sens开发者_StackOverflowible resolution to this so I've ended up adding an @ in front of the breaking assertions for now.
Looks like DOMDocument
takes issue with html5. You can try Xpath:
$this->assertXpath("//form[@id = 'login']");
精彩评论