1
0
mirror of https://github.com/mrclay/minify.git synced 2025-08-19 20:31:27 +02:00

Large restructuring

Moves all dependency building into App
bootstrap.php returns an App instance
The app loads config files as necessary
Moves logging to Monolog
Moves HTTP digest auth to packagist component
Rely on sys_get_temp_dir
Env hosts $_POST and allows defaults when reading
HTML helper uses the App and can handle less files
Source factory assumes strings are filenames
Fixes JsClosureCompilerTest::test6 (API now handles ES5 by default)
Exclude JsClosureCompilerTest due to API limitations
config.php can now return a Minify\Config object
Variables set in config.php are now moved to a `Minify\Config` object,
allowing better static analysis.
The `zlib.output_compression` set is moved into `Minify::serve`.
This commit is contained in:
Steve Clay
2016-02-27 01:13:28 -05:00
parent 0b466c0892
commit 4710509c68
30 changed files with 629 additions and 637 deletions

View File

@@ -51,7 +51,7 @@ class JsClosureCompilerTest extends PHPUnit_Framework_TestCase
{
$src = "(function(){})();";
$minOutput = $this->compile($src, array(
Minify_JS_ClosureCompiler::OPTION_MAX_BYTES => 0
Minify_JS_ClosureCompiler::OPTION_MAX_BYTES => 0,
));
$this->assertSame($src, $minOutput, 'With no limit set, it should compile properly');
@@ -65,7 +65,7 @@ class JsClosureCompilerTest extends PHPUnit_Framework_TestCase
$e = null;
try {
$this->compile($src, array(
Minify_JS_ClosureCompiler::OPTION_MAX_BYTES => $allowedBytes
Minify_JS_ClosureCompiler::OPTION_MAX_BYTES => $allowedBytes,
));
} catch (Minify_JS_ClosureCompiler_Exception $e) {
}
@@ -78,10 +78,14 @@ class JsClosureCompilerTest extends PHPUnit_Framework_TestCase
// Test additional options passed to HTTP request
public function test6()
{
$ecmascript5 = "[1,].length;";
$ecmascript3 = "[1,].length;";
$e = null;
try {
$this->compile($ecmascript5);
$this->compile($ecmascript3, array(
Minify_JS_ClosureCompiler::OPTION_ADDITIONAL_OPTIONS => array(
'language' => 'ECMASCRIPT3',
),
));
} catch (Minify_JS_ClosureCompiler_Exception $e) {
}
$this->assertInstanceOf('Minify_JS_ClosureCompiler_Exception', $e, 'Throws Minify_JS_ClosureCompiler_Exception');
@@ -94,8 +98,8 @@ class JsClosureCompilerTest extends PHPUnit_Framework_TestCase
$minExpected = '1;';
$minOutput = $this->compile($ecmascript5, array(
Minify_JS_ClosureCompiler::OPTION_ADDITIONAL_OPTIONS => array(
'language' => 'ECMASCRIPT5'
)
'language' => 'ECMASCRIPT5',
),
));
$this->assertSame($minExpected, $minOutput, 'Language option should make it compile');
}