1
0
mirror of https://github.com/mrclay/minify.git synced 2025-01-17 21:28:14 +01:00
minify/tests/MinifyLinesTest.php
2016-05-19 15:14:27 -04:00

40 lines
1.2 KiB
PHP

<?php
class MinifyLinesTest extends TestCase
{
public function test_lines()
{
$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());
$files = glob(self::$test_files . "/lines/*.in.js");
// uncomment to debug one
//$files = array(self::$test_files . "/lines/basic.in.js");
foreach ($files as $file) {
$ret = $minify->serve($controller, array(
'debug' => true,
'quiet' => true,
'encodeOutput' => false,
'files' => array($file),
));
$outFile = str_replace('.in.js', '.out.js', $file);
$exp = file_get_contents($outFile);
// uncomment to set up expected output
//file_put_contents($outFile, $ret['content']);
$this->assertEquals($exp, $ret['content'], "Did not match: " . basename($outFile));
}
}
}