From 01b089d9be046db1253cb3bb90e8635b50fddd84 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Fri, 4 Dec 2009 12:36:00 -0500 Subject: Added minify plugin --- .../minify/min_unit_tests/test_Minify_CSS.php | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 plugins/Minify/extlib/minify/min_unit_tests/test_Minify_CSS.php (limited to 'plugins/Minify/extlib/minify/min_unit_tests/test_Minify_CSS.php') diff --git a/plugins/Minify/extlib/minify/min_unit_tests/test_Minify_CSS.php b/plugins/Minify/extlib/minify/min_unit_tests/test_Minify_CSS.php new file mode 100644 index 000000000..96e187525 --- /dev/null +++ b/plugins/Minify/extlib/minify/min_unit_tests/test_Minify_CSS.php @@ -0,0 +1,53 @@ +read())) { + if (preg_match('/^([\w\\-]+)\.css$/', $entry, $m)) { + $list[] = $m[1]; + } + } + $d->close(); + + foreach ($list as $item) { + + $options = array(); + if ($item === 'paths_prepend') { + $options = array('prependRelativePath' => '../'); + } elseif ($item === 'paths_rewrite') { + $options = array('currentDir' => $thisDir . '/_test_files/css'); + $tempDocRoot = $_SERVER['DOCUMENT_ROOT']; + $_SERVER['DOCUMENT_ROOT'] = $thisDir; + } + + $src = file_get_contents($cssPath . "/{$item}.css"); + $minExpected = file_get_contents($cssPath . "/{$item}.min.css"); + $minOutput = Minify_CSS::minify($src, $options); + + // reset doc root as configured + if ($item === 'paths_rewrite') { + $_SERVER['DOCUMENT_ROOT'] = $tempDocRoot; + } + + $passed = assertTrue($minExpected === $minOutput, 'Minify_CSS : ' . $item); + + if (__FILE__ === realpath($_SERVER['SCRIPT_FILENAME'])) { + echo "\n---Output: " .strlen($minOutput). " bytes\n\n{$minOutput}\n\n"; + if (!$passed) { + echo "---Expected: " .strlen($minExpected). " bytes\n\n{$minExpected}\n\n"; + echo "---Source: " .strlen($src). " bytes\n\n{$src}\n\n\n"; + } + } + } +} + +test_CSS(); -- cgit v1.2.3-54-g00ecf