aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2017-01-03 11:42:21 +0100
committerArthurHoaro <arthur@hoa.ro>2017-01-05 16:16:23 +0100
commita0df06517bada0f811b464017ce385290e02c2bf (patch)
tree6bc3e99a9e9b93eb3e0f531f67a607dec748f407 /tests
parentadc4aee80f7cd3242f65f0b316af2b560a64712c (diff)
downloadShaarli-a0df06517bada0f811b464017ce385290e02c2bf.tar.gz
Shaarli-a0df06517bada0f811b464017ce385290e02c2bf.tar.zst
Shaarli-a0df06517bada0f811b464017ce385290e02c2bf.zip
Minor improvements regarding #705 (coding style, unit tests, etc.)
Diffstat (limited to 'tests')
-rw-r--r--tests/ApplicationUtilsTest.php44
-rw-r--r--tests/Updater/UpdaterTest.php1
-rw-r--r--tests/utils/config/configJson.json.php3
3 files changed, 47 insertions, 1 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}
diff --git a/tests/Updater/UpdaterTest.php b/tests/Updater/UpdaterTest.php
index 0171daad..a1530996 100644
--- a/tests/Updater/UpdaterTest.php
+++ b/tests/Updater/UpdaterTest.php
@@ -2,6 +2,7 @@
2 2
3require_once 'application/config/ConfigManager.php'; 3require_once 'application/config/ConfigManager.php';
4require_once 'tests/Updater/DummyUpdater.php'; 4require_once 'tests/Updater/DummyUpdater.php';
5require_once 'inc/rain.tpl.class.php';
5 6
6/** 7/**
7 * Class UpdaterTest. 8 * Class UpdaterTest.
diff --git a/tests/utils/config/configJson.json.php b/tests/utils/config/configJson.json.php
index 06a302e8..13d38c66 100644
--- a/tests/utils/config/configJson.json.php
+++ b/tests/utils/config/configJson.json.php
@@ -24,7 +24,8 @@
24 }, 24 },
25 "resource": { 25 "resource": {
26 "datastore": "tests\/utils\/config\/datastore.php", 26 "datastore": "tests\/utils\/config\/datastore.php",
27 "data_dir": "tests\/utils\/config" 27 "data_dir": "tests\/utils\/config",
28 "raintpl_tpl": "tpl/"
28 }, 29 },
29 "plugins": { 30 "plugins": {
30 "WALLABAG_VERSION": 1 31 "WALLABAG_VERSION": 1