From Dries in #399488: Invalid markup generated by l().:
Ah, another reason to have an XHTML verifier in SimpleTest. Maybe we could start with a simple XML validator using some of the PHP5 functionality.
Opening this issue to get a discussion going. I've already done some work on this, mostly using validateOnParse and validate() on the DOMDocument object that SimpleTest loads the HTML into.
Some questions before digging deeper though:
When should we validate? On each request that gets run through parse()? Using a flag 'validateXhtml' on drupalGet/drupalPost? Or add an extra assertion called assertValidXhtml?
Comments
Comment #1
mr.baileysHere is a first stab at this.
The patch adds "AssertValidXhtml" as an assertion. It uses DOMDocument::validate() to validate the document against the DTD. For now it'll only work against Drupal's XHTML+RDFa DTD.
The large size of the patch is caused by the fact that the DTDs are bundled with it: we cannot download these from W3C on each request, and we cannot use an XML cache since setting one up and maintaining one in a platform independent manner is not possible (I think). Hence the bundling and the "replace doctype to have it point at our local files"-logic.
Patch also adds "assertValidXhtml" after parsing each http request, so I'm pretty sure this will cause some errors with the testbot... (Setting to CNR to see what the impact of this is)
Comment #3
mr.baileys+ screenshot of a failed XHTML validation run.
Comment #4
boombatower commentedAlready had: #355185: Add HTML validation to functional tests ... mark one as duplicate?
Comment #5
mr.baileysYes, let's continue this in the issue you mention.