Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dep upgrade #666

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,22 @@
"wiki": "https://github.com/mrclay/minify/blob/master/docs"
},
"autoload": {
"classmap": ["lib/"]
"classmap": [
"lib/"
]
},
"autoload-dev": {
"psr-4": {"Minify\\Test\\": "tests/"}
"psr-4": {
"Minify\\Test\\": "tests/"
}
},
"config": {
"platform": {
"php": "5.3.29"
},
"sort-packages": true
},
"require": {
"php": "^5.3.0 || ^7.0",
"ext-pcre": "*",
"intervention/httpauth": "~2.0",
"intervention/httpauth": "^3.0",
"marcusschwarz/lesserphp": "^0.5.1",
"monolog/monolog": "~1.1|~2.0",
"mrclay/jsmin-php": "~2",
Expand All @@ -42,7 +43,7 @@
"firephp/firephp-core": "~0.4.0",
"leafo/scssphp": "^0.3 || ^0.6 || ^0.7",
"meenie/javascript-packer": "~1.1",
"phpunit/phpunit": "^4.8.36",
"phpunit/phpunit": "^8.0",
"tedivm/jshrink": "~1.1.0"
},
"suggest": {
Expand All @@ -57,4 +58,4 @@
"dev-master": "3.0.x-dev"
}
}
}
}
1 change: 0 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="vendor/autoload.php">

<testsuites>
Expand Down
8 changes: 4 additions & 4 deletions tests/LessSourceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class LessSourceTest extends TestCase
{
public function setUp()
public function setUp(): void
{
$this->realDocRoot = $_SERVER['DOCUMENT_ROOT'];
$_SERVER['DOCUMENT_ROOT'] = self::$document_root;
Expand All @@ -32,11 +32,11 @@ public function testLessTimestamp()

$max = max($mtime1, $mtime2);

$options = array(
$options = [
'groupsConfigFile' => "$baseDir/htmlHelper_groupsConfig.php",
);
];
$res = Minify_HTML_Helper::getUri('less', $options);

$this->assertEquals("/min/g=less&amp;{$max}", $res);
}
}
}
29 changes: 13 additions & 16 deletions tests/MinifyCSSUriRewriterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,52 +6,49 @@

class MinifyCSSUriRewriterTest extends TestCase
{
public function setUp()
public function setUp(): void
{
Minify_CSS_UriRewriter::$debugText = '';
}

public function test1()
{
$in = file_get_contents(self::$test_files . '/css_uriRewriter/in.css');
$expected = file_get_contents(self::$test_files . '/css_uriRewriter/exp.css');
$in = file_get_contents(self::$test_files.'/css_uriRewriter/in.css');
$expected = file_get_contents(self::$test_files.'/css_uriRewriter/exp.css');
$actual = Minify_CSS_UriRewriter::rewrite(
$in
, self::$test_files . '/css_uriRewriter' // currentDir
$in, self::$test_files.'/css_uriRewriter' // currentDir
, self::$document_root // use DOCUMENT_ROOT = '/full/path/to/min_unit_tests'
);

$this->assertEquals($expected, $actual, 'rewrite, debug: ' . Minify_CSS_UriRewriter::$debugText);
$this->assertEquals($expected, $actual, 'rewrite, debug: '.Minify_CSS_UriRewriter::$debugText);
}

public function test2()
{
$in = file_get_contents(self::$test_files . '/css_uriRewriter/in.css');
$expected = file_get_contents(self::$test_files . '/css_uriRewriter/exp_prepend.css');
$in = file_get_contents(self::$test_files.'/css_uriRewriter/in.css');
$expected = file_get_contents(self::$test_files.'/css_uriRewriter/exp_prepend.css');
$actual = Minify_CSS_UriRewriter::prepend($in, 'http://cnd.com/A/B/');

$this->assertEquals($expected, $actual, 'prepend1, debug: ' . Minify_CSS_UriRewriter::$debugText);
$this->assertEquals($expected, $actual, 'prepend1, debug: '.Minify_CSS_UriRewriter::$debugText);
}

public function test3()
{
$in = file_get_contents(self::$test_files . '/css_uriRewriter/in.css');
$expected = file_get_contents(self::$test_files . '/css_uriRewriter/exp_prepend2.css');
$in = file_get_contents(self::$test_files.'/css_uriRewriter/in.css');
$expected = file_get_contents(self::$test_files.'/css_uriRewriter/exp_prepend2.css');
$actual = Minify_CSS_UriRewriter::prepend($in, '//cnd.com/A/B/');

$this->assertEquals($expected, $actual, 'prepend2, debug: ' . Minify_CSS_UriRewriter::$debugText);
$this->assertEquals($expected, $actual, 'prepend2, debug: '.Minify_CSS_UriRewriter::$debugText);
}

public function test4()
{
$in = '../../../../assets/skins/sam/sprite.png';
$exp = '/yui/assets/skins/sam/sprite.png';
$actual = Minify_CSS_UriRewriter::rewriteRelative(
$in
, 'sf_root_dir\web\yui\menu\assets\skins\sam'
, 'sf_root_dir\web'
$in, 'sf_root_dir\web\yui\menu\assets\skins\sam', 'sf_root_dir\web'
);

$this->assertEquals($exp, $actual, 'Issue 99, debug: ' . Minify_CSS_UriRewriter::$debugText);
$this->assertEquals($exp, $actual, 'Issue 99, debug: '.Minify_CSS_UriRewriter::$debugText);
}
}
10 changes: 5 additions & 5 deletions tests/MinifyCacheAPCTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@

class MinifyCacheAPCTest extends TestCase
{
public function setUp()
public function setUp(): void
{
if (!function_exists('apc_store')) {
if (! function_exists('apc_store')) {
// FIXME: is APCu extension ok too?
$this->markTestSkipped("To test this component, install APC extension");
$this->markTestSkipped('To test this component, install APC extension');
}
}

public function test1()
{
$data = str_repeat(md5(time()) . 'í', 100); // 3400 bytes in UTF-8
$data = str_repeat(md5(time()).'í', 100); // 3400 bytes in UTF-8
$id = 'Minify_test_cache';

$cache = new Minify_Cache_APC();
$this->assertTestCache($cache, $id, $data);
}
}
}
19 changes: 9 additions & 10 deletions tests/MinifyCacheMemcacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ class MinifyCacheMemcacheTest extends TestCase
/** @var Memcache */
private $mc;

public function setUp()
public function setUp(): void
{
if (!function_exists('memcache_set')) {
$this->markTestSkipped("To test this component, install memcache in PHP");
if (! function_exists('memcache_set')) {
$this->markTestSkipped('To test this component, install memcache in PHP');
}

$this->mc = new Memcache();
if (!$this->mc->connect('localhost', 11211)) {
$this->markTestSkipped("Memcache server not found on localhost:11211");
if (! $this->mc->connect('localhost', 11211)) {
$this->markTestSkipped('Memcache server not found on localhost:11211');
}
}

public function test1()
{
$data = str_repeat(md5(time()) . 'í', 100); // 3400 bytes in UTF-8
$data = str_repeat(md5(time()).'í', 100); // 3400 bytes in UTF-8
$id = 'Minify_test_memcache';
$cache = new Minify_Cache_Memcache($this->mc);

Expand All @@ -33,16 +33,15 @@ public function test1()

public function test2()
{
if (!function_exists('gzencode')) {
$this->markTestSkipped("enable gzip extension to test this");
if (! function_exists('gzencode')) {
$this->markTestSkipped('enable gzip extension to test this');
}

$data = str_repeat(md5(time()) . 'í', 100); // 3400 bytes in UTF-8
$data = str_repeat(md5(time()).'í', 100); // 3400 bytes in UTF-8
$id = 'Minify_test_memcache.gz';
$cache = new Minify_Cache_Memcache($this->mc);

$data = gzencode($data);
$this->assertTestCache($cache, $id, $data);
}
}

10 changes: 5 additions & 5 deletions tests/MinifyCacheWinCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@

class MinifyCacheWinCacheTest extends TestCase
{
public function setUp()
public function setUp(): void
{
if (!function_exists('wincache_ucache_info')) {
$this->markTestSkipped("To test this component, install WinCache extension");
if (! function_exists('wincache_ucache_info')) {
$this->markTestSkipped('To test this component, install WinCache extension');
}
}

public function test1()
{
$data = str_repeat(md5(time()) . 'í', 100); // 3400 bytes in UTF-8
$data = str_repeat(md5(time()).'í', 100); // 3400 bytes in UTF-8
$id = 'Minify_test_cache';

$cache = new Minify_Cache_WinCache();
$this->assertTestCache($cache, $id, $data);
}
}
}
10 changes: 5 additions & 5 deletions tests/MinifyCacheZendPlatformTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@

class MinifyCacheZendPlatformTest extends TestCase
{
public function setUp()
public function setUp(): void
{
if (!function_exists('output_cache_put')) {
if (! function_exists('output_cache_put')) {
// FIXME: be specific what to actually install
$this->markTestSkipped("To test this component, install ZendPlatform");
$this->markTestSkipped('To test this component, install ZendPlatform');
}
}

public function test1()
{
$data = str_repeat(md5(time()) . 'í', 100); // 3400 bytes in UTF-8
$data = str_repeat(md5(time()).'í', 100); // 3400 bytes in UTF-8
$id = 'Minify_test_cache';

$cache = new Minify_Cache_ZendPlatform();
$this->assertTestCache($cache, $id, $data);
}
}
}
34 changes: 17 additions & 17 deletions tests/MinifyClosureCompilerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class MinifyClosureCompilerTest extends TestCase
{
public static function setupBeforeClass()
public static function setupBeforeClass(): void
{
parent::setupBeforeClass();
Minify_ClosureCompiler::$isDebug = true;
Expand All @@ -17,7 +17,7 @@ public static function setupBeforeClass()
// put it under tests dir as 'compiler.jar'

// set minimum necessary settings
Minify_ClosureCompiler::$jarFile = __DIR__ . DIRECTORY_SEPARATOR . 'compiler.jar';
Minify_ClosureCompiler::$jarFile = __DIR__.DIRECTORY_SEPARATOR.'compiler.jar';
Minify_ClosureCompiler::$tempDir = sys_get_temp_dir();
}

Expand All @@ -40,42 +40,42 @@ public function test1()
}

/**
* Test minimisation with the minimum necessary settings
* Test minimisation with the minimum necessary settings.
*/
public function test2()
{
$this->assertHasJar();
$src = "
$src = '
(function (window, undefined){
function addOne(input) {
return 1 + input;
}
window.addOne = addOne;
window.undefined = undefined;
})(window);
";
$minExpected = "(function(a,b){a.addOne=function(a){return 1+a};a.undefined=b})(window);";
';
$minExpected = '(function(a,b){a.addOne=function(a){return 1+a};a.undefined=b})(window);';
$minOutput = Minify_ClosureCompiler::minify($src);
$this->assertSame($minExpected, $minOutput, 'minimum necessary settings');
}

/**
* Test minimisation with advanced compilation level
* Test minimisation with advanced compilation level.
*/
public function test3()
{
$this->assertHasJar();
$src = "function unused() {};";
$src = 'function unused() {};';
$minExpected = '';
$options = array(
'compilation_level' => 'ADVANCED_OPTIMIZATIONS'
);
$options = [
'compilation_level' => 'ADVANCED_OPTIMIZATIONS',
];
$minOutput = Minify_ClosureCompiler::minify($src, $options);
$this->assertSame($minExpected, $minOutput, 'advanced optimizations');
}

/**
* Test that closure compiler does not produce unneeded noise
* Test that closure compiler does not produce unneeded noise.
*
* @see https://code.google.com/p/closure-compiler/issues/detail?id=513
*
Expand All @@ -100,16 +100,16 @@ public function testLanguageOptions()

$src = $this->getDataFile('js/jscomp.polyfill.js');
$exp = $this->getDataFile('js/jscomp.polyfill.min.js');
$options = array(
$options = [
'language_in' => 'ECMASCRIPT3',
);
];

$res = Minify_ClosureCompiler::minify($src, $options);
$this->assertSame($exp, $res);

$options = array(
$options = [
'language_in' => 'ECMASCRIPT6',
);
];
$exp = $this->getDataFile('js/jscomp.polyfilled.min.js');
$res = Minify_ClosureCompiler::minify($src, $options);
$this->assertSame($exp, $res);
Expand All @@ -119,7 +119,7 @@ protected function assertHasJar()
{
$this->assertNotEmpty(Minify_ClosureCompiler::$jarFile);
try {
$this->assertFileExists(Minify_ClosureCompiler::$jarFile, "Have closure compiler compiler.jar");
$this->assertFileExists(Minify_ClosureCompiler::$jarFile, 'Have closure compiler compiler.jar');
} catch (Exception $e) {
$this->markTestSkipped($e->getMessage());
}
Expand Down
Loading