mirror of
https://github.com/mrclay/minify.git
synced 2025-08-06 14:16:28 +02:00
YUI test: ensure jar is in test dir as closure compiler test
This commit is contained in:
committed by
Steve Clay
parent
79bcb7d5fe
commit
e328c0b4af
@@ -39,7 +39,7 @@ class MinifyClosureCompilerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function test2()
|
public function test2()
|
||||||
{
|
{
|
||||||
$this->assertHasCompilerJar();
|
$this->assertHasJar();
|
||||||
$src = "
|
$src = "
|
||||||
(function (window, undefined){
|
(function (window, undefined){
|
||||||
function addOne(input) {
|
function addOne(input) {
|
||||||
@@ -59,7 +59,7 @@ class MinifyClosureCompilerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function test3()
|
public function test3()
|
||||||
{
|
{
|
||||||
$this->assertHasCompilerJar();
|
$this->assertHasJar();
|
||||||
$src = "function unused() {};";
|
$src = "function unused() {};";
|
||||||
$minExpected = '';
|
$minExpected = '';
|
||||||
$minOutput = Minify_ClosureCompiler::minify($src, array(
|
$minOutput = Minify_ClosureCompiler::minify($src, array(
|
||||||
@@ -68,7 +68,7 @@ class MinifyClosureCompilerTest extends TestCase
|
|||||||
$this->assertSame($minExpected, $minOutput, 'advanced optimizations');
|
$this->assertSame($minExpected, $minOutput, 'advanced optimizations');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function assertHasCompilerJar()
|
protected function assertHasJar()
|
||||||
{
|
{
|
||||||
$this->assertNotEmpty(Minify_ClosureCompiler::$jarFile);
|
$this->assertNotEmpty(Minify_ClosureCompiler::$jarFile);
|
||||||
$this->assertFileExists(Minify_ClosureCompiler::$jarFile, "Have closure compiler compiler.jar");
|
$this->assertFileExists(Minify_ClosureCompiler::$jarFile, "Have closure compiler compiler.jar");
|
||||||
|
@@ -6,12 +6,16 @@ class MinifyYuiCSSTest extends TestCase
|
|||||||
{
|
{
|
||||||
parent::setupBeforeClass();
|
parent::setupBeforeClass();
|
||||||
|
|
||||||
// To test this, install the .jar file and customize the constant in:
|
// To test more functionality, download a yuicompressor.jar from
|
||||||
|
// https://github.com/yui/yuicompressor/releases
|
||||||
Minify_YUICompressor::$jarFile = '/usr/share/java/yuicompressor.jar';
|
// put it under tests dir as 'yuicompressor.jar'
|
||||||
|
Minify_YUICompressor::$jarFile = __DIR__ . DIRECTORY_SEPARATOR . 'yuicompressor.jar';
|
||||||
Minify_YUICompressor::$tempDir = sys_get_temp_dir();
|
Minify_YUICompressor::$tempDir = sys_get_temp_dir();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setUp() {
|
||||||
|
$this->assertHasJar();
|
||||||
|
}
|
||||||
|
|
||||||
public function test1()
|
public function test1()
|
||||||
{
|
{
|
||||||
@@ -40,4 +44,10 @@ class MinifyYuiCSSTest extends TestCase
|
|||||||
$minOutput = Minify_YUICompressor::minifyCss($src, $options);
|
$minOutput = Minify_YUICompressor::minifyCss($src, $options);
|
||||||
$this->assertEquals($minExpected, $minOutput);
|
$this->assertEquals($minExpected, $minOutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function assertHasJar()
|
||||||
|
{
|
||||||
|
$this->assertNotEmpty(Minify_YUICompressor::$jarFile );
|
||||||
|
$this->assertFileExists(Minify_YUICompressor::$jarFile , "Have YUI yuicompressor.jar");
|
||||||
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user