diff --git a/min_unit_tests/test_Minify_HTML.php b/min_unit_tests/test_Minify_HTML.php deleted file mode 100644 index 442c5f3..0000000 --- a/min_unit_tests/test_Minify_HTML.php +++ /dev/null @@ -1,55 +0,0 @@ - array('Minify_CSSmin', 'minify') - ,'jsMinifier' => array('JSMin\\JSMin', 'minify') - )); - $time = microtime(true) - $time; - - $passed = assertTrue($minExpected === $minOutput, 'Minify_HTML'); - - if (__FILE__ === realpath($_SERVER['SCRIPT_FILENAME'])) { - if ($passed) { - echo "\n---Source: ", countBytes($src), " bytes\n" - , "---Output: ", countBytes($minOutput), " bytes (", round($time * 1000), " ms)\n\n{$minOutput}\n\n\n"; - } else { - echo "\n---Output: ", countBytes($minOutput), " bytes (", round($time * 1000), " ms)\n\n{$minOutput}\n\n" - , "---Expected: ", countBytes($minExpected), " bytes\n\n{$minExpected}\n\n" - , "---Source: ", countBytes($src), " bytes\n\n{$src}\n\n\n"; - } - } - - $src = file_get_contents($thisDir . '/_test_files/html/before2.html'); - $minExpected = file_get_contents($thisDir . '/_test_files/html/before2.min.html'); - - $time = microtime(true); - $minOutput = Minify_HTML::minify($src, array( - 'cssMinifier' => array('Minify_CSSmin', 'minify') - ,'jsMinifier' => array('JSMin\\JSMin', 'minify') - )); - $time = microtime(true) - $time; - - $passed = assertTrue($minExpected === $minOutput, 'Minify_HTML'); - - if (__FILE__ === realpath($_SERVER['SCRIPT_FILENAME'])) { - if ($passed) { - echo "\n---Source: ", countBytes($src), " bytes\n" - , "---Output: ", countBytes($minOutput), " bytes (", round($time * 1000), " ms)\n\n{$minOutput}\n\n\n"; - } else { - echo "\n---Output: ", countBytes($minOutput), " bytes (", round($time * 1000), " ms)\n\n{$minOutput}\n\n" - , "---Expected: ", countBytes($minExpected), " bytes\n\n{$minExpected}\n\n" - , "---Source: ", countBytes($src), " bytes\n\n{$src}\n\n\n"; - } - } -} - -test_HTML(); diff --git a/min_unit_tests/test_all.php b/min_unit_tests/test_all.php index b4e5436..7ce81bc 100644 --- a/min_unit_tests/test_all.php +++ b/min_unit_tests/test_all.php @@ -3,7 +3,6 @@ require 'test_Minify.php'; require 'test_Minify_CSS.php'; require 'test_Minify_CSS_UriRewriter.php'; -require 'test_Minify_HTML.php'; require 'test_Minify_Lines.php'; require 'test_HTTP_ConditionalGet.php'; require 'test_environment.php'; diff --git a/tests/MinifyHTMLTest.php b/tests/MinifyHTMLTest.php new file mode 100644 index 0000000..defb144 --- /dev/null +++ b/tests/MinifyHTMLTest.php @@ -0,0 +1,30 @@ + array('Minify_CSSmin', 'minify'), + 'jsMinifier' => array('JSMin\\JSMin', 'minify'), + )); + + $this->assertEquals($minExpected, $minOutput); + } + + public function test2() + { + $src = file_get_contents(self::$test_files . '/html/before2.html'); + $minExpected = file_get_contents(self::$test_files . '/html/before2.min.html'); + + $minOutput = Minify_HTML::minify($src, array( + 'cssMinifier' => array('Minify_CSSmin', 'minify'), + 'jsMinifier' => array('JSMin\\JSMin', 'minify'), + )); + + $this->assertEquals($minExpected, $minOutput); + } +}