diff options
Diffstat (limited to 'tests/Updater')
-rw-r--r-- | tests/Updater/UpdaterTest.php | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/Updater/UpdaterTest.php b/tests/Updater/UpdaterTest.php index a1530996..1d15cfaa 100644 --- a/tests/Updater/UpdaterTest.php +++ b/tests/Updater/UpdaterTest.php | |||
@@ -422,4 +422,48 @@ $GLOBALS[\'privateLinkByDefault\'] = true;'; | |||
422 | $this->assertTrue($updater->updateMethodDatastoreIds()); | 422 | $this->assertTrue($updater->updateMethodDatastoreIds()); |
423 | $this->assertEquals($checksum, hash_file('sha1', self::$testDatastore)); | 423 | $this->assertEquals($checksum, hash_file('sha1', self::$testDatastore)); |
424 | } | 424 | } |
425 | |||
426 | /** | ||
427 | * Test defaultTheme update with default settings: nothing to do. | ||
428 | */ | ||
429 | public function testDefaultThemeWithDefaultSettings() | ||
430 | { | ||
431 | $sandbox = 'sandbox/config'; | ||
432 | copy(self::$configFile . '.json.php', $sandbox . '.json.php'); | ||
433 | $this->conf = new ConfigManager($sandbox); | ||
434 | $updater = new Updater([], [], $this->conf, true); | ||
435 | $this->assertTrue($updater->updateMethodDefaultTheme()); | ||
436 | |||
437 | $this->assertEquals('tpl/', $this->conf->get('resource.raintpl_tpl')); | ||
438 | $this->assertEquals('default', $this->conf->get('resource.theme')); | ||
439 | $this->conf = new ConfigManager($sandbox); | ||
440 | $this->assertEquals('tpl/', $this->conf->get('resource.raintpl_tpl')); | ||
441 | $this->assertEquals('default', $this->conf->get('resource.theme')); | ||
442 | unlink($sandbox . '.json.php'); | ||
443 | } | ||
444 | |||
445 | /** | ||
446 | * Test defaultTheme update with a custom theme in a subfolder | ||
447 | */ | ||
448 | public function testDefaultThemeWithCustomTheme() | ||
449 | { | ||
450 | $theme = 'iamanartist'; | ||
451 | $sandbox = 'sandbox/config'; | ||
452 | copy(self::$configFile . '.json.php', $sandbox . '.json.php'); | ||
453 | $this->conf = new ConfigManager($sandbox); | ||
454 | mkdir('sandbox/'. $theme); | ||
455 | touch('sandbox/'. $theme .'/linklist.html'); | ||
456 | $this->conf->set('resource.raintpl_tpl', 'sandbox/'. $theme .'/'); | ||
457 | $updater = new Updater([], [], $this->conf, true); | ||
458 | $this->assertTrue($updater->updateMethodDefaultTheme()); | ||
459 | |||
460 | $this->assertEquals('sandbox', $this->conf->get('resource.raintpl_tpl')); | ||
461 | $this->assertEquals($theme, $this->conf->get('resource.theme')); | ||
462 | $this->conf = new ConfigManager($sandbox); | ||
463 | $this->assertEquals('sandbox', $this->conf->get('resource.raintpl_tpl')); | ||
464 | $this->assertEquals($theme, $this->conf->get('resource.theme')); | ||
465 | unlink($sandbox . '.json.php'); | ||
466 | unlink('sandbox/'. $theme .'/linklist.html'); | ||
467 | rmdir('sandbox/'. $theme); | ||
468 | } | ||
425 | } | 469 | } |