2 require_once '_inc.php';
4 require_once 'Minify/HTML.php';
5 require_once 'Minify/CSS.php';
6 require_once 'JSMin.php';
12 $src = file_get_contents($thisDir . '/_test_files/html/before.html');
13 $minExpected = file_get_contents($thisDir . '/_test_files/html/before.min.html');
15 $time = microtime(true);
16 $minOutput = Minify_HTML::minify($src, array(
17 'cssMinifier' => array('Minify_CSS', 'minify')
18 ,'jsMinifier' => array('JSMin', 'minify')
20 $time = microtime(true) - $time;
22 $passed = assertTrue($minExpected === $minOutput, 'Minify_HTML');
24 if (__FILE__ === realpath($_SERVER['SCRIPT_FILENAME'])) {
26 echo "\n---Source: ", strlen($src), " bytes\n"
27 , "---Output: ", strlen($minOutput), " bytes (", round($time * 1000), " ms)\n\n{$minOutput}\n\n\n";
29 echo "\n---Output: ", strlen($minOutput), " bytes (", round($time * 1000), " ms)\n\n{$minOutput}\n\n"
30 , "---Expected: ", strlen($minExpected), " bytes\n\n{$minExpected}\n\n"
31 , "---Source: ", strlen($src), " bytes\n\n{$src}\n\n\n";
35 $src = file_get_contents($thisDir . '/_test_files/html/before2.html');
36 $minExpected = file_get_contents($thisDir . '/_test_files/html/before2.min.html');
38 $time = microtime(true);
39 $minOutput = Minify_HTML::minify($src, array(
40 'cssMinifier' => array('Minify_CSS', 'minify')
41 ,'jsMinifier' => array('JSMin', 'minify')
43 $time = microtime(true) - $time;
45 $passed = assertTrue($minExpected === $minOutput, 'Minify_HTML');
47 if (__FILE__ === realpath($_SERVER['SCRIPT_FILENAME'])) {
49 echo "\n---Source: ", strlen($src), " bytes\n"
50 , "---Output: ", strlen($minOutput), " bytes (", round($time * 1000), " ms)\n\n{$minOutput}\n\n\n";
52 echo "\n---Output: ", strlen($minOutput), " bytes (", round($time * 1000), " ms)\n\n{$minOutput}\n\n"
53 , "---Expected: ", strlen($minExpected), " bytes\n\n{$minExpected}\n\n"
54 , "---Source: ", strlen($src), " bytes\n\n{$src}\n\n\n";