diff options
Diffstat (limited to 'tests/Updater')
-rw-r--r-- | tests/Updater/UpdaterTest.php | 64 |
1 files changed, 64 insertions, 0 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 | } |