The Gitlab instance will be restarted on Monday April 28th at 2AM. There will be a short interruption of service.

Skip to content
Snippets Groups Projects
Commit 01ecfe3e authored by Demian Katz's avatar Demian Katz
Browse files

Fixed line endings.

parent c078650f
No related merge requests found
......@@ -38,98 +38,98 @@ use VuFindTheme\LessCompiler;
* @link http://vufind.org/wiki/vufind2:unit_tests Wiki
*/
class LessCompilerTest extends Unit\TestCase
{
/**
* Our brave test subject
*
* @var VuFindTheme\LessCompiler
*/
protected $testDest;
/**
* Our brave test subject
*
* @var VuFindTheme\LessCompiler
*/
protected $compiler;
public static function setUpBeforeClass()
{
$temp = sys_get_temp_dir();
{
/**
* Our brave test subject
*
* @var VuFindTheme\LessCompiler
*/
protected $testDest;
/**
* Our brave test subject
*
* @var VuFindTheme\LessCompiler
*/
protected $compiler;
public static function setUpBeforeClass()
{
$temp = sys_get_temp_dir();
$testDest = $temp . '/vufind_less_comp_test/';
// Create directory structure, recursively
mkdir($testDest . 'themes/parent/css/', 0777, true);
mkdir($testDest . 'themes/parent/less/', 0777, true);
mkdir($testDest . 'themes/child/css/', 0777, true);
mkdir($testDest . 'themes/child/less/', 0777, true);
file_put_contents(
$testDest . 'themes/parent/theme.config.php',
'<?php return array("extends"=>false, "less"=>array("compiled.less"));'
);
file_put_contents(
$testDest . 'themes/child/theme.config.php',
'<?php return array("extends"=>"parent", "less"=>array("compiled.less"));'
);
file_put_contents(
$testDest . 'themes/parent/less/compiled.less',
'@import "parent";'
);
file_put_contents(
$testDest . 'themes/parent/less/parent.less',
'body { color:#00D; a { color:#F00; } }'
);
file_put_contents(
$testDest . 'themes/child/less/compiled.less',
'@import "parent"; @black: #000; div {border:1px solid @black;}'
);
}
public function setUp()
{
$temp = sys_get_temp_dir();
$perms = fileperms($temp);
$this->testDest = $temp . '/vufind_less_comp_test/';
if (!($perms & 0x0002)) {
$markTestSkipped('No write permissions in system temporary file');
}
$this->compiler = new LessCompiler();
$this->compiler->setBasePath($temp . '/vufind_less_comp_test');
}
public static function tearDownAfterClass()
{
$temp = sys_get_temp_dir();
$testDest = $temp . '/vufind_less_comp_test/';
// Delete directory structure
unlink($testDest . 'themes/child/less/compiled.less');
unlink($testDest . 'themes/child/theme.config.php');
unlink($testDest . 'themes/parent/less/compiled.less');
unlink($testDest . 'themes/parent/less/parent.less');
unlink($testDest . 'themes/parent/theme.config.php');
rmdir($testDest . 'themes/child/css');
rmdir($testDest . 'themes/child/less');
rmdir($testDest . 'themes/child');
rmdir($testDest . 'themes/parent/less');
rmdir($testDest . 'themes/parent/css');
rmdir($testDest . 'themes/parent');
rmdir($testDest . 'themes');
rmdir($testDest);
}
public function testThemeCompile()
{
$this->compiler->compile(array('child'));
$this->assertTrue(file_exists($this->testDest . 'themes/child/css/compiled.css'));
$this->assertFalse(file_exists($this->testDest . 'themes/parent/css/compiled.css'));
unlink($this->testDest . 'themes/child/css/compiled.css');
}
public function testEmptyCompile()
{
$this->compiler->compile(array());
$this->assertTrue(file_exists($this->testDest . 'themes/child/css/compiled.css'));
$this->assertTrue(file_exists($this->testDest . 'themes/parent/css/compiled.css'));
unlink($this->testDest . 'themes/child/css/compiled.css');
unlink($this->testDest . 'themes/parent/css/compiled.css');
// Create directory structure, recursively
mkdir($testDest . 'themes/parent/css/', 0777, true);
mkdir($testDest . 'themes/parent/less/', 0777, true);
mkdir($testDest . 'themes/child/css/', 0777, true);
mkdir($testDest . 'themes/child/less/', 0777, true);
file_put_contents(
$testDest . 'themes/parent/theme.config.php',
'<?php return array("extends"=>false, "less"=>array("compiled.less"));'
);
file_put_contents(
$testDest . 'themes/child/theme.config.php',
'<?php return array("extends"=>"parent", "less"=>array("compiled.less"));'
);
file_put_contents(
$testDest . 'themes/parent/less/compiled.less',
'@import "parent";'
);
file_put_contents(
$testDest . 'themes/parent/less/parent.less',
'body { color:#00D; a { color:#F00; } }'
);
file_put_contents(
$testDest . 'themes/child/less/compiled.less',
'@import "parent"; @black: #000; div {border:1px solid @black;}'
);
}
public function setUp()
{
$temp = sys_get_temp_dir();
$perms = fileperms($temp);
$this->testDest = $temp . '/vufind_less_comp_test/';
if (!($perms & 0x0002)) {
$markTestSkipped('No write permissions in system temporary file');
}
$this->compiler = new LessCompiler();
$this->compiler->setBasePath($temp . '/vufind_less_comp_test');
}
public static function tearDownAfterClass()
{
$temp = sys_get_temp_dir();
$testDest = $temp . '/vufind_less_comp_test/';
// Delete directory structure
unlink($testDest . 'themes/child/less/compiled.less');
unlink($testDest . 'themes/child/theme.config.php');
unlink($testDest . 'themes/parent/less/compiled.less');
unlink($testDest . 'themes/parent/less/parent.less');
unlink($testDest . 'themes/parent/theme.config.php');
rmdir($testDest . 'themes/child/css');
rmdir($testDest . 'themes/child/less');
rmdir($testDest . 'themes/child');
rmdir($testDest . 'themes/parent/less');
rmdir($testDest . 'themes/parent/css');
rmdir($testDest . 'themes/parent');
rmdir($testDest . 'themes');
rmdir($testDest);
}
public function testThemeCompile()
{
$this->compiler->compile(array('child'));
$this->assertTrue(file_exists($this->testDest . 'themes/child/css/compiled.css'));
$this->assertFalse(file_exists($this->testDest . 'themes/parent/css/compiled.css'));
unlink($this->testDest . 'themes/child/css/compiled.css');
}
public function testEmptyCompile()
{
$this->compiler->compile(array());
$this->assertTrue(file_exists($this->testDest . 'themes/child/css/compiled.css'));
$this->assertTrue(file_exists($this->testDest . 'themes/parent/css/compiled.css'));
unlink($this->testDest . 'themes/child/css/compiled.css');
unlink($this->testDest . 'themes/parent/css/compiled.css');
}
}
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment