mirror of
https://github.com/mrclay/minify.git
synced 2025-08-08 07:06:49 +02:00
drop test_Minify_CSS.php
This commit is contained in:
@@ -1,51 +0,0 @@
|
|||||||
<?php
|
|
||||||
require_once '_inc.php';
|
|
||||||
|
|
||||||
function test_CSS()
|
|
||||||
{
|
|
||||||
global $thisDir;
|
|
||||||
|
|
||||||
$cssPath = __DIR__ . '/_test_files/css';
|
|
||||||
|
|
||||||
// build test file list
|
|
||||||
$d = dir($cssPath);
|
|
||||||
while (false !== ($entry = $d->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: " .countBytes($minOutput). " bytes\n\n{$minOutput}\n\n";
|
|
||||||
if (!$passed) {
|
|
||||||
echo "---Expected: " .countBytes($minExpected). " bytes\n\n{$minExpected}\n\n";
|
|
||||||
echo "---Source: " .countBytes($src). " bytes\n\n{$src}\n\n\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
test_CSS();
|
|
@@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require 'test_Minify.php';
|
require 'test_Minify.php';
|
||||||
require 'test_Minify_CSS.php';
|
|
||||||
require 'test_environment.php';
|
require 'test_environment.php';
|
||||||
|
Reference in New Issue
Block a user