aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/ApplicationUtilsTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ApplicationUtilsTest.php')
-rw-r--r--tests/ApplicationUtilsTest.php44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/ApplicationUtilsTest.php b/tests/ApplicationUtilsTest.php
index 634bd0ed..c39649e8 100644
--- a/tests/ApplicationUtilsTest.php
+++ b/tests/ApplicationUtilsTest.php
@@ -331,4 +331,48 @@ class ApplicationUtilsTest extends PHPUnit_Framework_TestCase
331 ApplicationUtils::checkResourcePermissions($conf) 331 ApplicationUtils::checkResourcePermissions($conf)
332 ); 332 );
333 } 333 }
334
335 /**
336 * Test getThemes() with existing theme directories.
337 */
338 public function testGetThemes()
339 {
340 $themes = ['theme1', 'default', 'Bl1p_- bL0p'];
341 foreach ($themes as $theme) {
342 mkdir('sandbox/tpl/'. $theme, 0777, true);
343 }
344
345 // include a file which should be ignored
346 touch('sandbox/tpl/supertheme');
347
348 $res = ApplicationUtils::getThemes('sandbox/tpl/');
349 foreach ($res as $theme) {
350 $this->assertTrue(in_array($theme, $themes));
351 }
352 $this->assertFalse(in_array('supertheme', $res));
353
354 foreach ($themes as $theme) {
355 rmdir('sandbox/tpl/'. $theme);
356 }
357 unlink('sandbox/tpl/supertheme');
358 rmdir('sandbox/tpl');
359 }
360
361 /**
362 * Test getThemes() without any theme dir.
363 */
364 public function testGetThemesEmpty()
365 {
366 mkdir('sandbox/tpl/', 0777, true);
367 $this->assertEquals([], ApplicationUtils::getThemes('sandbox/tpl/'));
368 rmdir('sandbox/tpl/');
369 }
370
371 /**
372 * Test getThemes() with an invalid path.
373 */
374 public function testGetThemesInvalid()
375 {
376 $this->assertEquals([], ApplicationUtils::getThemes('nope'));
377 }
334} 378}