aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Updater
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Updater')
-rw-r--r--tests/Updater/UpdaterTest.php45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/Updater/UpdaterTest.php b/tests/Updater/UpdaterTest.php
index 0171daad..1d15cfaa 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.
@@ -421,4 +422,48 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
421 $this->assertTrue($updater->updateMethodDatastoreIds()); 422 $this->assertTrue($updater->updateMethodDatastoreIds());
422 $this->assertEquals($checksum, hash_file('sha1', self::$testDatastore)); 423 $this->assertEquals($checksum, hash_file('sha1', self::$testDatastore));
423 } 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 }
424} 469}