| 1 |
<?php |
| 2 |
|
| 3 |
namespace Minify\Test; |
| 4 |
|
| 5 |
use Minify_HTML_Helper; |
| 6 |
|
| 7 |
/** |
| 8 |
* @requires php < 7.3 |
| 9 |
* @see https://github.com/mrclay/minify/pull/685 |
| 10 |
*/ |
| 11 |
class LessSourceTest extends TestCase |
| 12 |
{ |
| 13 |
public function setUp() |
| 14 |
{ |
| 15 |
$this->realDocRoot = $_SERVER['DOCUMENT_ROOT']; |
| 16 |
$_SERVER['DOCUMENT_ROOT'] = self::$document_root; |
| 17 |
} |
| 18 |
|
| 19 |
/** |
| 20 |
* @link https://github.com/mrclay/minify/issues/500 |
| 21 |
*/ |
| 22 |
public function testLessTimestamp() |
| 23 |
{ |
| 24 |
$baseDir = self::$test_files; |
| 25 |
|
| 26 |
$mainLess = "$baseDir/main.less"; |
| 27 |
$includedLess = "$baseDir/included.less"; |
| 28 |
|
| 29 |
// touch timestamp with 1s difference |
| 30 |
touch($mainLess); |
| 31 |
sleep(1); |
| 32 |
touch($includedLess); |
| 33 |
|
| 34 |
$mtime1 = filemtime($mainLess); |
| 35 |
$mtime2 = filemtime($includedLess); |
| 36 |
|
| 37 |
$max = max($mtime1, $mtime2); |
| 38 |
|
| 39 |
$options = array( |
| 40 |
'groupsConfigFile' => "$baseDir/htmlHelper_groupsConfig.php", |
| 41 |
); |
| 42 |
$res = Minify_HTML_Helper::getUri('less', $options); |
| 43 |
|
| 44 |
$this->assertEquals("/min/g=less&{$max}", $res); |
| 45 |
} |
| 46 |
} |
| 47 |
|