|
23 | 23 |
|
24 | 24 | use Combodo\iTop\Test\UnitTest\ItopTestCase; |
25 | 25 | use iTopDesignFormat; |
| 26 | +use utils; |
26 | 27 |
|
27 | 28 |
|
28 | 29 | /** |
29 | | - * Class iTopDesignFormatChecklistTest |
30 | | - * |
31 | | - * @covers iTopDesignFormat |
| 30 | + * Class SetupCssIntegrityChecklistTest |
32 | 31 | */ |
33 | 32 | class SetupCssIntegrityChecklistTest extends ItopTestCase |
34 | 33 | { |
35 | 34 | public function testSetupCssIntegrity() |
36 | 35 | { |
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"); |
42 | 52 | } |
43 | 53 | } |
0 commit comments