phpunit icon indicating copy to clipboard operation
phpunit copied to clipboard

assertTag - content - isHTML -failed

Open pjsb opened this issue 13 years ago • 2 comments

I tried to test my framework, which generates HTML. The assertTag is wonderfull to check it, but it fails in some cases, see below.

Does assertTag do any HTML validation too? I know that some examples are invalid html, therefore I set isHTML to skip maybe any HTML validation to false, but with the same result.

1) RenderTest::testRender with data set #9 ('area', false, '<area>SomeText</area>')
Failed asserting that false is true.


2) RenderTest::testRender with data set #19 ('param', false, '<param>SomeText</param>')
Failed asserting that false is true.


3) RenderTest::testRender with data set #34 ('base', false, '<base>SomeText</base>')
Failed asserting that false is true.


4) RenderTest::testRender with data set #36 ('head', false, '<head>SomeText</head>')
Failed asserting that false is true.


5) RenderTest::testRender with data set #40 ('script', false, '<script>SomeText</script>')
Failed asserting that false is true.


6) RenderTest::testRender with data set #41 ('style', false, '<style>SomeText</style>')
Failed asserting that false is true.


7) RenderTest::testRender with data set #44 ('col', false, '<col>SomeText</col>')
Failed asserting that false is true.´´´

EDIT: Ok after fixing self closing tags, there are only two issues

1) RenderTest::testRender with data set #40 ('script', false, false, '<script>SomeText</script>')
Failed asserting that false is true.


2) RenderTest::testRender with data set #41 ('style', false, false, '<style>SomeText</style>')
Failed asserting that false is true.

But the question is the same? HTML validation? Does it validate the innerHTML also? Even if isHTML set to false?

Edit by @edorian: Fixed markdown

pjsb avatar Dec 31 '12 00:12 pjsb

Hi :)

isHtml = false means it's loaded as xml.

In both cases libxml_errors are used an reported on. (If we don't get valid dom documents we can't compare things in assertTag).

If you believe there is an issue I'd need a working reproduce case with your expectation but assertTag won't do comparisons on invalid/even-unloadable-by-the-crazy-flexible-dom-document-libxml-loader stuff.

edorian avatar Jan 04 '13 01:01 edorian

This is a bug. PHPUnit_Util_XML::getNodeText() does not account for CDATA sections.

whatthejeff avatar Mar 11 '13 06:03 whatthejeff