Skip to content

Commit 94c604a

Browse files
committed
N°3062 - Fix setup.css compilation test to ensure that it is versioned correctly.
1 parent 6995a3c commit 94c604a

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

tests/php-unit-tests/post-build-integration-tests/SetupCssIntegrityChecklistTest.php

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,31 @@
2323

2424
use Combodo\iTop\Test\UnitTest\ItopTestCase;
2525
use iTopDesignFormat;
26+
use utils;
2627

2728

2829
/**
29-
* Class iTopDesignFormatChecklistTest
30-
*
31-
* @covers iTopDesignFormat
30+
* Class SetupCssIntegrityChecklistTest
3231
*/
3332
class SetupCssIntegrityChecklistTest extends ItopTestCase
3433
{
3534
public function testSetupCssIntegrity()
3635
{
37-
$sSetupCssPath = APPROOT.'css/setup.css';
38-
$sSetupCssContent = file_get_contents($sSetupCssPath);
39-
$this->assertContains('/* integrityCheck: begin (do not remove/edit) */', $sSetupCssContent);
40-
$this->assertContains('/* integrityCheck: end (do not remove/edit) */', $sSetupCssContent);
41-
$this->assertGreaterThan(4000, strlen($sSetupCssContent), "Test if the resulting file $sSetupCssPath is long enough, the value is totally arbitrary (at the time of the writing the file is 5660o long");
36+
$sCssFileAbsPath = APPROOT."css/setup.css";
37+
38+
// First check if the compiled file exists
39+
$this->assertTrue(file_exists($sCssFileAbsPath));
40+
41+
// Then check that it is not empty
42+
$sVersionedCssFileContent = file_get_contents($sCssFileAbsPath);
43+
$this->assertGreaterThan(0, strlen($sVersionedCssFileContent), "Compiled setup.css file seems empty");
44+
45+
// Then check that the compiled file is up-to-date
46+
$sScssFileRelPath = "css/setup.scss";
47+
$sScssFileAbsPath = APPROOT . $sScssFileRelPath;
48+
touch($sScssFileAbsPath);
49+
utils::GetCSSFromSASS($sScssFileRelPath);
50+
$sCompiledCssFileContent = file_get_contents($sCssFileAbsPath);
51+
$this->assertSame($sCompiledCssFileContent, $sVersionedCssFileContent, "Compiled setup.css file does not seem up to date as the one compiled just now is different");
4252
}
4353
}

0 commit comments

Comments
 (0)