Active
Project:
Drupal core
Version:
main
Component:
simpletest.module
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
6 Jan 2009 at 20:33 UTC
Updated:
10 Jan 2021 at 08:56 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
boombatower commentedSince we already use DOM to parse document should be easy.
DOMDocument::validate -> http://us3.php.net/manual/en/domdocument.validate.php
Comment #2
boombatower commentedHere is some testing I have done.
The validation seems to work great...checks some subtle things I tried.
I included some code MYDOMDocument in a user comment to collect the actually errors. This may/maynot be something we want to collect. Also the class requires cleanup (and I can't get to work either).
Comment #4
mr.baileysI had something similar over at #402356: XHTML validator needed in SimpleTest. (now marked as duplicate).
Some comments after reviewing your patch:
I've attached my patch here for comparison/documentation (I don't mean to hijack your issue). Also set this to CNR to let the testbot play with it once.
Also note that there is a similar effort by Damien Tournoud in (#402254: How do we do on XHTML validation?). While not full XHTML validation, it does bring to light a number of bugs by just changing one line in SimpleTest.
Comment #5
mr.baileysComment #6
boombatower commentedThe performance I got was terrible as well and that was the same conclusion I drew...and if you delete the DTD references from the template it runs better (my hack to confirm).
Thus I am open to whatever solution you have if it runs better. I just remembered that existed and played with it to see what I could get to work. Glad to see someone else interested in this.
Comment #7
mr.baileysProblem is: by dropping the DTD I think we're defeating the purpose of XHTML validation, since it's the DTD that drives most of it. Haven't tested this, but my fear is that be removing the DTD, we're essentially downgrading to just HTML validation.
Maybe we should start by building a test case containing things we want the validator to notice? (note that some of these will get caught even by normal HTML validation as they're not XHTML specific):
Comment #9
boombatower commentedI don't think we should remove the DTD tags...I would just commenting that that in fact seems to be the problem and we need some sort of solution to make this feasible.
Comment #10
dries commentedAwesome. One option, but I'm not sure I like that, is to make the validation optional; i.e. there could be a checkbox on the SimpleTest page that allows people to enable/disable validation. HTML validation is probably not something we'd need to run all the time, if gets run once in a while, that might be "good enough".
Comment #11
damien tournoud commentedI don't think we actually need all that, at least not right now. DOMDocument::loadHTML() seems to know a lot about HTML, including (at least part of) the DTDs. I just posted a simple patch to suppress error hiding in #402254: How do we do on XHTML validation?... it resulted in 1442 exceptions. We should first concentrate on fixing those, then come back to full-fledged validation to see if it makes a difference.
Comment #12
damien tournoud commentedLet's postpone this one until we investigate the 1442 exceptions of #402254: How do we do on XHTML validation?.
Comment #13
damien tournoud commentedUniformizing tags.
Comment #14
dave reid+1 for this. Would be even better if we could somehow get a way to validate the RSS/XML feeds that Drupal generates.
Comment #15
ohnobinki commented+1
Comment #16
mgiffordWhat happened to drupal_web_test_case.php anyways?
Other than that (and the move within the core/ directory) the patch applies pretty nicely still.
Any thoughts on addressing this in D8?
EDIT: Just occurred to me that maybe this was still at D7 because it is all xhtml not HTML5.
Still occurs to me that we should have this validation.
Comment #17
hanno commentedYes, a validation check is also a good idea for HTML5. In a DTAP development process it's great when developers get feedback about the HTML they produce.
Comment #18
mgiffordI dislike acronyms - http://en.wikipedia.org/wiki/Development,_testing,_acceptance_and_produc...
But yes, absolutely still an issue in HTML5, so generalizing the title and tagging.
Comment #19
hanno commentedHTML5 validation is not yet available in Drupal #1333730: [Meta] PHP DOM (libxml2) misinterprets HTML5
Postpone this issue until we have a validation function to use?
Comment #25
mile23We're not updating WTB or simpletest any more, but an option for automatic HTML validation might be a good thing to add to our Mink driver.
Comment #26
mile23Also we shouldn't be postponed on #402254: How do we do on XHTML validation? which is from 2014.
Comment #30
donquixote commentedThis issue is now focused on D8.
For D7 we can do this simple change first: #3191922: Collect DOMDocument errors in web test, instead of suppressing them.