diff --git a/tests/GlValidatorTest.php b/tests/GlValidatorTest.php index b5d64a3..4f30731 100644 --- a/tests/GlValidatorTest.php +++ b/tests/GlValidatorTest.php @@ -27,21 +27,6 @@ */ class GlValidatorTest extends \PHPUnit_Framework_TestCase { - private function file_get_contents_utf8($filename) - { - $opts = array( - 'http' => array( - 'method' => "GET", - 'header' => "Content-Type: text/html; charset=utf-8" - ) - ); - - $context = stream_context_create($opts); - $result = @file_get_contents($filename, false, $context); - - return $result; - } - public function testHtml() { $finder = new Finder(); @@ -90,32 +75,7 @@ function (SplFileInfo $file) use (&$count) { $src = __DIR__ . "/expected/" . $file; $dst = __DIR__ . "/result/" . $file; - - $expectedDom = new \DomDocument(); - $expectedDom->loadHTMLFile($src); - $expectedDom->preserveWhiteSpace = false; - - $actualDom = new \DomDocument(); - $actualDom->loadHTMLFile($dst); - $actualDom->preserveWhiteSpace = false; - - $this->assertEquals($expectedDom->saveHTML(), $actualDom->saveHTML()); - - /* - $srccontent = file_get_contents($src); - $dstcontent = file_get_contents($dst); - - $srcencoding = mb_detect_encoding($srccontent); - $dstencoding = mb_detect_encoding($dstcontent); - - $this->assertEquals(0, strcmp($srccontent, $dstcontent),"$srcencoding\n\n$dstencoding"); - */ - //$this->assertEquals($srcencoding, $dstencoding, "$src:$srcencoding different to $dst:$dstencoding "); - - //$this->assertEquals($srccontent, $dstcontent, "$src different to $dst"); - - //print_r($srccontent); - //print_r($dstcontent); + $this->assertFileEquals($src, $dst); } } @@ -181,18 +141,7 @@ function (SplFileInfo $file) use (&$count) { $src = __DIR__ . "/expected/" . $file; $dst = __DIR__ . "/result/" . $file; - $srccontent = file_get_contents($src); - $dstcontent = file_get_contents($dst); - - $srcencoding = mb_detect_encoding($srccontent); - $dstencoding = mb_detect_encoding($dstcontent); - - $this->assertEquals($srcencoding, $dstencoding, "$src:$srcencoding different to $dst:$dstencoding "); - - $this->assertEquals($srccontent, $dstcontent, "$src different to $dst"); - - //var_dump($srccontent); - //var_dump($dstcontent); + $this->assertFileEquals($src, $dst); } } } \ No newline at end of file diff --git a/tests/expected/test1/w3c_html_index.html b/tests/expected/test1/w3c_html_index.html index c317831..59cc128 100644 --- a/tests/expected/test1/w3c_html_index.html +++ b/tests/expected/test1/w3c_html_index.html @@ -1 +1 @@ -Showing results for uploaded file index.html - Nu Html Checker

test1\index.html

  1. Info: The Content-Type was text/html. Using the HTML parser.

  2. Info: Using the schema for HTML with SVG 1.1, MathML 3.0, RDFa 1.1, and ITS 2.0 support.

The document validates according to the specified schema(s) and to additional constraints checked by the validator.

\ No newline at end of file +Showing results for uploaded file index.html - Nu Html Checker

test1\index.html

  1. Info: The Content-Type was text/html. Using the HTML parser.

  2. Info: Using the schema for HTML with SVG 1.1, MathML 3.0, RDFa 1.1, and ITS 2.0 support.

The document validates according to the specified schema(s) and to additional constraints checked by the validator.

\ No newline at end of file