mirror of
https://github.com/mrclay/minify.git
synced 2025-08-29 08:40:11 +02:00
add test for #500
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
* @package Minify
|
||||
*/
|
||||
|
||||
/**
|
||||
/**
|
||||
* You may wish to use the Minify URI Builder app to suggest
|
||||
* changes. http://yourdomain/min/builder/
|
||||
*
|
||||
|
40
tests/LessSourceTest.php
Normal file
40
tests/LessSourceTest.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
class LessSourceTest extends TestCase
|
||||
{
|
||||
public function setUp()
|
||||
{
|
||||
$this->realDocRoot = $_SERVER['DOCUMENT_ROOT'];
|
||||
$_SERVER['DOCUMENT_ROOT'] = self::$document_root;
|
||||
}
|
||||
|
||||
/**
|
||||
* @link https://github.com/mrclay/minify/issues/500
|
||||
*/
|
||||
public function testLessTimestamp()
|
||||
{
|
||||
$baseDir = self::$test_files;
|
||||
|
||||
$mainLess = "$baseDir/main.less";
|
||||
$includedLess = "$baseDir/included.less";
|
||||
|
||||
// touch timestamp with 1s difference
|
||||
touch($mainLess);
|
||||
sleep(1);
|
||||
touch($includedLess);
|
||||
|
||||
$mtime1 = filemtime($mainLess);
|
||||
var_dump($mtime1);
|
||||
$mtime2 = filemtime($includedLess);
|
||||
var_dump($mtime2);
|
||||
|
||||
$max = max($mtime1, $mtime2);
|
||||
|
||||
$options = array(
|
||||
'groupsConfigFile' => "$baseDir/htmlHelper_groupsConfig.php",
|
||||
);
|
||||
$res = Minify_HTML_Helper::getUri('less', $options);
|
||||
|
||||
$this->assertEquals("/min/g=less&{$max}", $res);
|
||||
}
|
||||
}
|
@@ -2,7 +2,11 @@
|
||||
|
||||
return array(
|
||||
'css' => array(
|
||||
'//_test_files/css/paths_prepend.css'
|
||||
,'//_test_files/css/styles.css'
|
||||
)
|
||||
'//_test_files/css/paths_prepend.css',
|
||||
'//_test_files/css/styles.css',
|
||||
),
|
||||
|
||||
'less' => array(
|
||||
'//_test_files/main.less',
|
||||
),
|
||||
);
|
||||
|
1
tests/_test_files/included.less
Normal file
1
tests/_test_files/included.less
Normal file
@@ -0,0 +1 @@
|
||||
/* lesstest2.less */
|
33
tests/_test_files/main.less
Normal file
33
tests/_test_files/main.less
Normal file
@@ -0,0 +1,33 @@
|
||||
/*! preserving comment */
|
||||
@base: 24px;
|
||||
@border-color: #B2B;
|
||||
|
||||
/* import included-> */
|
||||
@import "included";
|
||||
/* <- import included */
|
||||
|
||||
.underline {
|
||||
border-bottom: 1px solid green
|
||||
}
|
||||
|
||||
#header {
|
||||
color: black;
|
||||
border: 1px solid @border-color + #222222;
|
||||
|
||||
.navigation {
|
||||
font-size: @base / 2;
|
||||
a {
|
||||
.underline;
|
||||
}
|
||||
}
|
||||
.logo {
|
||||
width: 300px;
|
||||
:hover {
|
||||
text-decoration: none
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
a normal comment
|
||||
*/
|
Reference in New Issue
Block a user