File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed
tests/WebFiori/Framework/Tests/Theme Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change 1414 * @author Ibrahim
1515 */
1616class 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 }
You can’t perform that action at this time.
0 commit comments