mirror of
https://github.com/mrclay/minify.git
synced 2025-08-04 21:27:52 +02:00
port MinifyCommentPreserverTest to phpunit
This commit is contained in:
committed by
Steve Clay
parent
316b384b1f
commit
3f0b99fb52
@@ -1,37 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
require_once '_inc.php';
|
|
||||||
|
|
||||||
function test_Minify_ImportProcessor()
|
|
||||||
{
|
|
||||||
global $thisDir;
|
|
||||||
|
|
||||||
$linDir = $thisDir . '/_test_files/importProcessor';
|
|
||||||
|
|
||||||
$expected = file_get_contents($linDir . '/css/output.css');
|
|
||||||
|
|
||||||
$actual = Minify_ImportProcessor::process($linDir . '/css/input.css');
|
|
||||||
|
|
||||||
$passed = assertTrue($expected === $actual, 'ImportProcessor');
|
|
||||||
|
|
||||||
if (__FILE__ === realpath($_SERVER['SCRIPT_FILENAME'])) {
|
|
||||||
echo "\n---Output: " .countBytes($actual). " bytes\n\n{$actual}\n\n";
|
|
||||||
if (!$passed) {
|
|
||||||
echo "---Expected: " .countBytes($expected). " bytes\n\n{$expected}\n\n\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$expectedIncludes = array (
|
|
||||||
realpath($linDir . '/css/input.css')
|
|
||||||
,realpath($linDir . '/css/adjacent.css')
|
|
||||||
,realpath($linDir . '/../css/styles.css')
|
|
||||||
,realpath($linDir . '/css/1/tv.css')
|
|
||||||
,realpath($linDir . '/css/1/adjacent.css')
|
|
||||||
,realpath($linDir . '/lib/css/example.css')
|
|
||||||
);
|
|
||||||
|
|
||||||
$passed = assertTrue($expectedIncludes === Minify_ImportProcessor::$filesIncluded
|
|
||||||
, 'ImportProcessor : included right files in right order');
|
|
||||||
}
|
|
||||||
|
|
||||||
test_Minify_ImportProcessor();
|
|
@@ -11,7 +11,6 @@ require 'test_Minify_CSS.php';
|
|||||||
require 'test_Minify_CSS_UriRewriter.php';
|
require 'test_Minify_CSS_UriRewriter.php';
|
||||||
require 'test_Minify_YuiCSS.php';
|
require 'test_Minify_YuiCSS.php';
|
||||||
require 'test_Minify_HTML.php';
|
require 'test_Minify_HTML.php';
|
||||||
require 'test_Minify_ImportProcessor.php';
|
|
||||||
require 'test_Minify_Lines.php';
|
require 'test_Minify_Lines.php';
|
||||||
require 'test_HTTP_Encoder.php';
|
require 'test_HTTP_Encoder.php';
|
||||||
require 'test_HTTP_ConditionalGet.php';
|
require 'test_HTTP_ConditionalGet.php';
|
||||||
|
24
tests/MinifyImportProcessorTest.php
Normal file
24
tests/MinifyImportProcessorTest.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class MinifyImportProcessorTest extends TestCase
|
||||||
|
{
|
||||||
|
public function test()
|
||||||
|
{
|
||||||
|
$linDir = self::$test_files . '/importProcessor';
|
||||||
|
|
||||||
|
$expected = file_get_contents($linDir . '/css/output.css');
|
||||||
|
$actual = Minify_ImportProcessor::process($linDir . '/css/input.css');
|
||||||
|
$this->assertSame($expected, $actual, 'ImportProcessor');
|
||||||
|
|
||||||
|
$expectedIncludes = array(
|
||||||
|
realpath($linDir . '/css/input.css'),
|
||||||
|
realpath($linDir . '/css/adjacent.css'),
|
||||||
|
realpath($linDir . '/../css/styles.css'),
|
||||||
|
realpath($linDir . '/css/1/tv.css'),
|
||||||
|
realpath($linDir . '/css/1/adjacent.css'),
|
||||||
|
realpath($linDir . '/lib/css/example.css'),
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertEquals($expectedIncludes, Minify_ImportProcessor::$filesIncluded, 'included right files in right order');
|
||||||
|
}
|
||||||
|
}
|
@@ -16,7 +16,8 @@ class TestCase extends PHPUnit_Framework_TestCase
|
|||||||
*
|
*
|
||||||
* @link http://stackoverflow.com/q/2736343/2314626
|
* @link http://stackoverflow.com/q/2736343/2314626
|
||||||
*/
|
*/
|
||||||
public function test_does_nothing() {
|
public function test_does_nothing()
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user