mirror of
https://github.com/mrclay/minify.git
synced 2025-08-19 12:21:20 +02:00
port MinifyLinesTest to phpunit
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once '_inc.php';
|
||||
|
||||
function test_Lines()
|
||||
{
|
||||
global $thisDir;
|
||||
|
||||
$exp = file_get_contents("{$thisDir}/_test_files/minify/lines_output.js");
|
||||
|
||||
$env = new Minify_Env();
|
||||
$sourceFactory = new Minify_Source_Factory($env, array(), new Minify_Cache_Null());
|
||||
$controller = new Minify_Controller_Files($env, $sourceFactory);
|
||||
$minify = new Minify(new Minify_Cache_Null());
|
||||
|
||||
$ret = $minify->serve($controller, array(
|
||||
'debug' => true
|
||||
,'quiet' => true
|
||||
,'encodeOutput' => false
|
||||
,'files' => array(
|
||||
"{$thisDir}/_test_files/js/before.js"
|
||||
)
|
||||
));
|
||||
|
||||
$passed = assertTrue($exp === $ret['content'], 'Minify_Lines');
|
||||
|
||||
if (__FILE__ === realpath($_SERVER['SCRIPT_FILENAME'])) {
|
||||
echo "\n---Output: " .countBytes($ret['content']). " bytes\n\n{$ret['content']}\n\n";
|
||||
if (!$passed) {
|
||||
echo "---Expected: " .countBytes($exp). " bytes\n\n{$exp}\n\n\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
test_Lines();
|
@@ -2,5 +2,4 @@
|
||||
|
||||
require 'test_Minify.php';
|
||||
require 'test_Minify_CSS.php';
|
||||
require 'test_Minify_Lines.php';
|
||||
require 'test_environment.php';
|
||||
|
29
tests/MinifyLinesTest.php
Normal file
29
tests/MinifyLinesTest.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
class MinifyLinesTest extends TestCase
|
||||
{
|
||||
public function test_lines()
|
||||
{
|
||||
$exp = file_get_contents(self::$test_files . "/minify/lines_output.js");
|
||||
|
||||
$env = new Minify_Env(array(
|
||||
'server' => array(
|
||||
'DOCUMENT_ROOT' => dirname(__DIR__),
|
||||
),
|
||||
));
|
||||
$sourceFactory = new Minify_Source_Factory($env, array(), new Minify_Cache_Null());
|
||||
$controller = new Minify_Controller_Files($env, $sourceFactory);
|
||||
$minify = new Minify(new Minify_Cache_Null());
|
||||
|
||||
$ret = $minify->serve($controller, array(
|
||||
'debug' => true
|
||||
,'quiet' => true
|
||||
,'encodeOutput' => false
|
||||
,'files' => array(
|
||||
self::$test_files . "/js/before.js"
|
||||
)
|
||||
));
|
||||
|
||||
$this->assertEquals($exp, $ret['content']);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user