1
0
mirror of https://github.com/mrclay/minify.git synced 2025-08-05 21:57:53 +02:00

YUI test: ensure jar is in test dir as closure compiler test

This commit is contained in:
Elan Ruusamäe
2015-11-19 11:29:00 +02:00
committed by Steve Clay
parent 79bcb7d5fe
commit e328c0b4af
2 changed files with 16 additions and 6 deletions

View File

@@ -39,7 +39,7 @@ class MinifyClosureCompilerTest extends TestCase
*/
public function test2()
{
$this->assertHasCompilerJar();
$this->assertHasJar();
$src = "
(function (window, undefined){
function addOne(input) {
@@ -59,7 +59,7 @@ class MinifyClosureCompilerTest extends TestCase
*/
public function test3()
{
$this->assertHasCompilerJar();
$this->assertHasJar();
$src = "function unused() {};";
$minExpected = '';
$minOutput = Minify_ClosureCompiler::minify($src, array(
@@ -68,7 +68,7 @@ class MinifyClosureCompilerTest extends TestCase
$this->assertSame($minExpected, $minOutput, 'advanced optimizations');
}
protected function assertHasCompilerJar()
protected function assertHasJar()
{
$this->assertNotEmpty(Minify_ClosureCompiler::$jarFile);
$this->assertFileExists(Minify_ClosureCompiler::$jarFile, "Have closure compiler compiler.jar");

View File

@@ -6,12 +6,16 @@ class MinifyYuiCSSTest extends TestCase
{
parent::setupBeforeClass();
// To test this, install the .jar file and customize the constant in:
Minify_YUICompressor::$jarFile = '/usr/share/java/yuicompressor.jar';
// To test more functionality, download a yuicompressor.jar from
// https://github.com/yui/yuicompressor/releases
// put it under tests dir as 'yuicompressor.jar'
Minify_YUICompressor::$jarFile = __DIR__ . DIRECTORY_SEPARATOR . 'yuicompressor.jar';
Minify_YUICompressor::$tempDir = sys_get_temp_dir();
}
public function setUp() {
$this->assertHasJar();
}
public function test1()
{
@@ -40,4 +44,10 @@ class MinifyYuiCSSTest extends TestCase
$minOutput = Minify_YUICompressor::minifyCss($src, $options);
$this->assertEquals($minExpected, $minOutput);
}
protected function assertHasJar()
{
$this->assertNotEmpty(Minify_YUICompressor::$jarFile );
$this->assertFileExists(Minify_YUICompressor::$jarFile , "Have YUI yuicompressor.jar");
}
}