diff options
author | ArthurHoaro <arthur@hoa.ro> | 2017-01-03 12:01:25 +0100 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2017-01-05 16:16:27 +0100 |
commit | 04a0e8ea34c241fdf6bd30b11f5242656f9cd1c2 (patch) | |
tree | 20c99e86f3fc862f90d3d7475f4a49b89557a7d4 /tests/Updater | |
parent | a0df06517bada0f811b464017ce385290e02c2bf (diff) | |
download | Shaarli-04a0e8ea34c241fdf6bd30b11f5242656f9cd1c2.tar.gz Shaarli-04a0e8ea34c241fdf6bd30b11f5242656f9cd1c2.tar.zst Shaarli-04a0e8ea34c241fdf6bd30b11f5242656f9cd1c2.zip |
Updater: keep custom theme preference with the new theme setting
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 | } |