mirror of
https://github.com/mrclay/minify.git
synced 2025-08-12 00:54:35 +02:00
port MinifyBuildTest to phpunit
This commit is contained in:
committed by
Steve Clay
parent
4bfe976916
commit
68f011d73f
@@ -1,33 +0,0 @@
|
|||||||
<?php
|
|
||||||
require_once '_inc.php';
|
|
||||||
|
|
||||||
function test_Minify_Build()
|
|
||||||
{
|
|
||||||
global $thisDir;
|
|
||||||
|
|
||||||
$file1 = $thisDir . '/_test_files/css/paths_prepend.css';
|
|
||||||
$file2 = $thisDir . '/_test_files/css/styles.css';
|
|
||||||
$maxTime = max(filemtime($file1), filemtime($file2));
|
|
||||||
|
|
||||||
$b = new Minify_Build($file1);
|
|
||||||
assertTrue($b->lastModified == filemtime($file1)
|
|
||||||
,'Minify_Build : single file path');
|
|
||||||
|
|
||||||
$b = new Minify_Build(array($file1, $file2));
|
|
||||||
assertTrue($maxTime == $b->lastModified
|
|
||||||
,'Minify_Build : multiple file paths');
|
|
||||||
|
|
||||||
$b = new Minify_Build(array(
|
|
||||||
$file1
|
|
||||||
,new Minify_Source(array('filepath' => $file2))
|
|
||||||
));
|
|
||||||
|
|
||||||
assertTrue($maxTime == $b->lastModified
|
|
||||||
,'Minify_Build : file path and a Minify_Source');
|
|
||||||
assertTrue($b->uri('/path') == "/path?{$maxTime}"
|
|
||||||
,'Minify_Build : uri() with no querystring');
|
|
||||||
assertTrue($b->uri('/path?hello') == "/path?hello&{$maxTime}"
|
|
||||||
,'Minify_Build : uri() with existing querystring');
|
|
||||||
}
|
|
||||||
|
|
||||||
test_Minify_Build();
|
|
@@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require 'test_Minify.php';
|
require 'test_Minify.php';
|
||||||
require 'test_Minify_Build.php';
|
|
||||||
require 'test_Minify_HTML_Helper.php';
|
require 'test_Minify_HTML_Helper.php';
|
||||||
require 'test_Minify_Cache_APC.php';
|
require 'test_Minify_Cache_APC.php';
|
||||||
require 'test_Minify_Cache_File.php';
|
require 'test_Minify_Cache_File.php';
|
||||||
@@ -18,5 +17,4 @@ require 'test_Minify_ImportProcessor.php';
|
|||||||
require 'test_Minify_Lines.php';
|
require 'test_Minify_Lines.php';
|
||||||
require 'test_HTTP_Encoder.php';
|
require 'test_HTTP_Encoder.php';
|
||||||
require 'test_HTTP_ConditionalGet.php';
|
require 'test_HTTP_ConditionalGet.php';
|
||||||
require 'test_JSMin.php';
|
|
||||||
require 'test_environment.php';
|
require 'test_environment.php';
|
||||||
|
23
tests/MinifyBuildTest.php
Normal file
23
tests/MinifyBuildTest.php
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class MinifyBuildTest extends TestCase
|
||||||
|
{
|
||||||
|
public function test()
|
||||||
|
{
|
||||||
|
$file1 = self::$test_files . '/css/paths_prepend.css';
|
||||||
|
$file2 = self::$test_files . '/css/styles.css';
|
||||||
|
$maxTime = max(filemtime($file1), filemtime($file2));
|
||||||
|
|
||||||
|
$b = new Minify_Build($file1);
|
||||||
|
$this->assertEquals($b->lastModified, filemtime($file1), 'single file path');
|
||||||
|
|
||||||
|
$b = new Minify_Build(array($file1, $file2));
|
||||||
|
$this->assertEquals($maxTime, $b->lastModified, 'multiple file paths');
|
||||||
|
|
||||||
|
$b = new Minify_Build(array($file1, new Minify_Source(array('filepath' => $file2))));
|
||||||
|
|
||||||
|
$this->assertEquals($maxTime, $b->lastModified, 'file path and a Minify_Source');
|
||||||
|
$this->assertEquals($b->uri('/path'), "/path?{$maxTime}", 'uri() with no querystring');
|
||||||
|
$this->assertEquals($b->uri('/path?hello'), "/path?hello&{$maxTime}", 'uri() with existing querystring');
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user