diff options
Diffstat (limited to 'tests/Updater')
-rw-r--r-- | tests/Updater/UpdaterTest.php | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/tests/Updater/UpdaterTest.php b/tests/Updater/UpdaterTest.php index 8b90fd5e..92ff5690 100644 --- a/tests/Updater/UpdaterTest.php +++ b/tests/Updater/UpdaterTest.php | |||
@@ -20,7 +20,7 @@ class UpdaterTest extends PHPUnit_Framework_TestCase | |||
20 | /** | 20 | /** |
21 | * @var string Config file path (without extension). | 21 | * @var string Config file path (without extension). |
22 | */ | 22 | */ |
23 | protected static $configFile = 'tests/utils/config/configJson'; | 23 | protected static $configFile = 'sandbox/config'; |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * @var ConfigManager | 26 | * @var ConfigManager |
@@ -32,6 +32,7 @@ class UpdaterTest extends PHPUnit_Framework_TestCase | |||
32 | */ | 32 | */ |
33 | public function setUp() | 33 | public function setUp() |
34 | { | 34 | { |
35 | copy('tests/utils/config/configJson.json.php', self::$configFile .'.json.php'); | ||
35 | $this->conf = new ConfigManager(self::$configFile); | 36 | $this->conf = new ConfigManager(self::$configFile); |
36 | } | 37 | } |
37 | 38 | ||
@@ -686,17 +687,48 @@ $GLOBALS[\'privateLinkByDefault\'] = true;'; | |||
686 | } | 687 | } |
687 | 688 | ||
688 | /** | 689 | /** |
689 | * Test updateMethodAtomDefault with show_atom set to true. | 690 | * Test updateMethodWebThumbnailer with thumbnails enabled. |
690 | * => nothing to do | ||
691 | */ | 691 | */ |
692 | public function testUpdateMethodWebThumbnailerEnabled() | 692 | public function testUpdateMethodWebThumbnailerEnabled() |
693 | { | 693 | { |
694 | $this->conf->remove('thumbnails'); | ||
694 | $this->conf->set('thumbnail.enable_thumbnails', true); | 695 | $this->conf->set('thumbnail.enable_thumbnails', true); |
695 | $updater = new Updater([], [], $this->conf, true); | 696 | $updater = new Updater([], [], $this->conf, true, $_SESSION); |
696 | $this->assertTrue($updater->updateMethodWebThumbnailer()); | 697 | $this->assertTrue($updater->updateMethodWebThumbnailer()); |
697 | $this->assertFalse($this->conf->exists('thumbnail')); | 698 | $this->assertFalse($this->conf->exists('thumbnail')); |
698 | $this->assertTrue($this->conf->get('thumbnails.enabled')); | 699 | $this->assertTrue($this->conf->get('thumbnails.enabled')); |
699 | $this->assertEquals(125, $this->conf->get('thumbnails.width')); | 700 | $this->assertEquals(125, $this->conf->get('thumbnails.width')); |
700 | $this->assertEquals(90, $this->conf->get('thumbnails.height')); | 701 | $this->assertEquals(90, $this->conf->get('thumbnails.height')); |
702 | $this->assertContains('You have enabled thumbnails', $_SESSION['warnings'][0]); | ||
703 | } | ||
704 | |||
705 | /** | ||
706 | * Test updateMethodWebThumbnailer with thumbnails disabled. | ||
707 | */ | ||
708 | public function testUpdateMethodWebThumbnailerDisabled() | ||
709 | { | ||
710 | $this->conf->remove('thumbnails'); | ||
711 | $this->conf->set('thumbnail.enable_thumbnails', false); | ||
712 | $updater = new Updater([], [], $this->conf, true, $_SESSION); | ||
713 | $this->assertTrue($updater->updateMethodWebThumbnailer()); | ||
714 | $this->assertFalse($this->conf->exists('thumbnail')); | ||
715 | $this->assertFalse($this->conf->get('thumbnails.enabled')); | ||
716 | $this->assertEquals(125, $this->conf->get('thumbnails.width')); | ||
717 | $this->assertEquals(90, $this->conf->get('thumbnails.height')); | ||
718 | $this->assertTrue(empty($_SESSION['warnings'])); | ||
719 | } | ||
720 | |||
721 | /** | ||
722 | * Test updateMethodWebThumbnailer with thumbnails disabled. | ||
723 | */ | ||
724 | public function testUpdateMethodWebThumbnailerNothingToDo() | ||
725 | { | ||
726 | $updater = new Updater([], [], $this->conf, true, $_SESSION); | ||
727 | $this->assertTrue($updater->updateMethodWebThumbnailer()); | ||
728 | $this->assertFalse($this->conf->exists('thumbnail')); | ||
729 | $this->assertTrue($this->conf->get('thumbnails.enabled')); | ||
730 | $this->assertEquals(90, $this->conf->get('thumbnails.width')); | ||
731 | $this->assertEquals(53, $this->conf->get('thumbnails.height')); | ||
732 | $this->assertTrue(empty($_SESSION['warnings'])); | ||
701 | } | 733 | } |
702 | } | 734 | } |