aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Updater/UpdaterTest.php64
-rw-r--r--tests/plugins/test/test.php2
2 files changed, 65 insertions, 1 deletions
diff --git a/tests/Updater/UpdaterTest.php b/tests/Updater/UpdaterTest.php
index fed175df..94e3c7d3 100644
--- a/tests/Updater/UpdaterTest.php
+++ b/tests/Updater/UpdaterTest.php
@@ -620,4 +620,68 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
620 $this->assertTrue($updater->updateMethodAtomDefault()); 620 $this->assertTrue($updater->updateMethodAtomDefault());
621 $this->assertTrue($this->conf->get('feed.show_atom')); 621 $this->assertTrue($this->conf->get('feed.show_atom'));
622 } 622 }
623
624 /**
625 * Test updateMethodDownloadSizeAndTimeoutConf, it should be set if none is already defined.
626 */
627 public function testUpdateMethodDownloadSizeAndTimeoutConf()
628 {
629 $sandboxConf = 'sandbox/config';
630 copy(self::$configFile . '.json.php', $sandboxConf . '.json.php');
631 $this->conf = new ConfigManager($sandboxConf);
632 $updater = new Updater([], [], $this->conf, true);
633 $this->assertTrue($updater->updateMethodDownloadSizeAndTimeoutConf());
634 $this->assertEquals(4194304, $this->conf->get('general.download_max_size'));
635 $this->assertEquals(30, $this->conf->get('general.download_timeout'));
636
637 $this->conf = new ConfigManager($sandboxConf);
638 $this->assertEquals(4194304, $this->conf->get('general.download_max_size'));
639 $this->assertEquals(30, $this->conf->get('general.download_timeout'));
640 }
641
642 /**
643 * Test updateMethodDownloadSizeAndTimeoutConf, it shouldn't be set if it is already defined.
644 */
645 public function testUpdateMethodDownloadSizeAndTimeoutConfIgnore()
646 {
647 $sandboxConf = 'sandbox/config';
648 copy(self::$configFile . '.json.php', $sandboxConf . '.json.php');
649 $this->conf = new ConfigManager($sandboxConf);
650 $this->conf->set('general.download_max_size', 38);
651 $this->conf->set('general.download_timeout', 70);
652 $updater = new Updater([], [], $this->conf, true);
653 $this->assertTrue($updater->updateMethodDownloadSizeAndTimeoutConf());
654 $this->assertEquals(38, $this->conf->get('general.download_max_size'));
655 $this->assertEquals(70, $this->conf->get('general.download_timeout'));
656 }
657
658 /**
659 * Test updateMethodDownloadSizeAndTimeoutConf, only the maz size should be set here.
660 */
661 public function testUpdateMethodDownloadSizeAndTimeoutConfOnlySize()
662 {
663 $sandboxConf = 'sandbox/config';
664 copy(self::$configFile . '.json.php', $sandboxConf . '.json.php');
665 $this->conf = new ConfigManager($sandboxConf);
666 $this->conf->set('general.download_max_size', 38);
667 $updater = new Updater([], [], $this->conf, true);
668 $this->assertTrue($updater->updateMethodDownloadSizeAndTimeoutConf());
669 $this->assertEquals(38, $this->conf->get('general.download_max_size'));
670 $this->assertEquals(30, $this->conf->get('general.download_timeout'));
671 }
672
673 /**
674 * Test updateMethodDownloadSizeAndTimeoutConf, only the time out should be set here.
675 */
676 public function testUpdateMethodDownloadSizeAndTimeoutConfOnlyTimeout()
677 {
678 $sandboxConf = 'sandbox/config';
679 copy(self::$configFile . '.json.php', $sandboxConf . '.json.php');
680 $this->conf = new ConfigManager($sandboxConf);
681 $this->conf->set('general.download_timeout', 3);
682 $updater = new Updater([], [], $this->conf, true);
683 $this->assertTrue($updater->updateMethodDownloadSizeAndTimeoutConf());
684 $this->assertEquals(4194304, $this->conf->get('general.download_max_size'));
685 $this->assertEquals(3, $this->conf->get('general.download_timeout'));
686 }
623} 687}
diff --git a/tests/plugins/test/test.php b/tests/plugins/test/test.php
index 3d750c90..2aaf5122 100644
--- a/tests/plugins/test/test.php
+++ b/tests/plugins/test/test.php
@@ -11,7 +11,7 @@ function hook_test_random($data)
11{ 11{
12 if (isset($data['_PAGE_']) && $data['_PAGE_'] == 'test') { 12 if (isset($data['_PAGE_']) && $data['_PAGE_'] == 'test') {
13 $data[1] = 'page test'; 13 $data[1] = 'page test';
14 } else if (isset($data['_LOGGEDIN_']) && $data['_LOGGEDIN_'] === true) { 14 } elseif (isset($data['_LOGGEDIN_']) && $data['_LOGGEDIN_'] === true) {
15 $data[1] = 'loggedin'; 15 $data[1] = 'loggedin';
16 } else { 16 } else {
17 $data[1] = $data[0]; 17 $data[1] = $data[0];