Skip to content

Commit

Permalink
Set include root and add info about errors
Browse files Browse the repository at this point in the history
  • Loading branch information
saltybeagle committed Jul 24, 2012
1 parent 7c6416a commit 8e8611b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tests/HTMLValidation/validate_shtml.phpt
Expand Up @@ -8,15 +8,19 @@ set_include_path('phar://' . __DIR__ . '/Services_W3C_HTMLValidator.phar/php');

require_once 'Services/W3C/HTMLValidator.php';

$files = new GlobIterator(__DIR__ . '/../../Templates/*.dwt', FilesystemIterator::CURRENT_AS_PATHNAME);
$files = new GlobIterator(dirname(dirname(__DIR__)) . '/Templates/*.dwt', FilesystemIterator::CURRENT_AS_PATHNAME);

$validator = new Services_W3C_HTMLValidator();

foreach ($files as $filename) {
$shtml = mod_include_file($filename);

if (!$validator->validateFragment($shtml)) {
echo "Invalid HTML in " . $filename;
$shtml = mod_include_file($filename, dirname(dirname(__DIR__)));

$response = $validator->validateFragment($shtml);
if (!$response->isValid()) {
echo "Invalid HTML in $filename]\n";
foreach ($response->errors as $error) {
echo ' Line:' . $error->line . ' Col:' . $error->col . ' Message: ' . $error->message . PHP_EOL;
}
}
}

Expand Down

0 comments on commit 8e8611b

Please sign in to comment.