Skip to content

Commit 8c74023

Browse files
committed
Update ThemeTest.php
1 parent 4cdb822 commit 8c74023

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

tests/WebFiori/Framework/Tests/Theme/ThemeTest.php

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,33 @@
1414
* @author Ibrahim
1515
*/
1616
class ThemeTest extends TestCase {
17-
public function testAvailableThemes00() {
17+
18+
protected function tearDown(): void {
19+
// Clean up theme assets from public directory
20+
$assetsPath = ROOT_PATH . DS . PUBLIC_FOLDER . DS . 'assets';
21+
if (is_dir($assetsPath)) {
22+
$themeDirs = ['FioriTheme', 'FioriTheme2'];
23+
foreach ($themeDirs as $themeDir) {
24+
$themePath = $assetsPath . DS . $themeDir;
25+
if (is_dir($themePath)) {
26+
$this->removeDirectory($themePath);
27+
}
28+
}
29+
}
30+
parent::tearDown();
31+
}
32+
33+
private function removeDirectory($dir) {
34+
if (!is_dir($dir)) {
35+
return;
36+
}
37+
$files = array_diff(scandir($dir), ['.', '..']);
38+
foreach ($files as $file) {
39+
$path = $dir . DS . $file;
40+
is_dir($path) ? $this->removeDirectory($path) : unlink($path);
41+
}
42+
rmdir($dir);
43+
} public function testAvailableThemes00() {
1844
$themes = ThemeManager::getRegisteredThemes();
1945
$this->assertEquals(2, count($themes));
2046
}

0 commit comments

Comments
 (0)