Problem/Motivation
The method drupal_web_test_case::parse()
uses DOMDocument->loadHTML()
to parse html content from a page.
Currently the call to $htmlDom->loadHTML(..)
is prepended with '@' for error suppression.
This is necessary because plenty of pages currently have problems in their html.
Unfortunately, the warning from ->loadHTML() are now lost.
It would be nice if we could verify at least for specific pages that they have no warnings.
Special considerations
It should be noted that DOMDocument->loadHTML() also passes without warnings for a html snippet without any header or surrounding '<html>'
tag.
Proposed resolution
Use a temporary error handler and collect the errors/warnings, instead of a suppression operator.
The errors can be collected in an object variable similar to ->elements.
We should then introduce new assertion methods to verify that a page has no DOM errors, or that it has very specific DOM errors.
We can use these after every call to ->drupalGet().
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Issue fork drupal-3191922
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
donquixote CreditAttribution: donquixote commentedComment #3
donquixote CreditAttribution: donquixote commentednicer title - I think
Comment #5
donquixote CreditAttribution: donquixote commented