10 class ThemeUtilsTest
extends \PHPUnit_Framework_TestCase
13 * Test getThemes() with existing theme directories.
15 public function testGetThemes()
17 $themes = ['theme1', 'default', 'Bl1p_- bL0p'];
18 foreach ($themes as $theme) {
19 mkdir('sandbox/tpl/'. $theme, 0755, true);
22 // include a file which should be ignored
23 touch('sandbox/tpl/supertheme');
25 $res = ThemeUtils
::getThemes('sandbox/tpl/');
26 foreach ($res as $theme) {
27 $this->assertTrue(in_array($theme, $themes));
29 $this->assertFalse(in_array('supertheme', $res));
31 foreach ($themes as $theme) {
32 rmdir('sandbox/tpl/'. $theme);
34 unlink('sandbox/tpl/supertheme');
39 * Test getThemes() without any theme dir.
41 public function testGetThemesEmpty()
43 mkdir('sandbox/tpl/', 0755, true);
44 $this->assertEquals([], ThemeUtils
::getThemes('sandbox/tpl/'));
45 rmdir('sandbox/tpl/');
49 * Test getThemes() with an invalid path.
51 public function testGetThemesInvalid()
53 $this->assertEquals([], ThemeUtils
::getThemes('nope'));