diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Updater/UpdaterTest.php | 40 | ||||
-rw-r--r-- | tests/utils/config/configJson.json.php | 12 |
2 files changed, 42 insertions, 10 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 | } |
diff --git a/tests/utils/config/configJson.json.php b/tests/utils/config/configJson.json.php index 061d4c28..a656b67c 100644 --- a/tests/utils/config/configJson.json.php +++ b/tests/utils/config/configJson.json.php | |||
@@ -61,11 +61,6 @@ | |||
61 | "dev": { | 61 | "dev": { |
62 | "debug": true | 62 | "debug": true |
63 | }, | 63 | }, |
64 | "thumbnails": { | ||
65 | "enabled": true, | ||
66 | "width": 125, | ||
67 | "height": 90 | ||
68 | }, | ||
69 | "updates": { | 64 | "updates": { |
70 | "check_updates": false, | 65 | "check_updates": false, |
71 | "check_updates_branch": "stable", | 66 | "check_updates_branch": "stable", |
@@ -79,6 +74,11 @@ | |||
79 | "language": "auto", | 74 | "language": "auto", |
80 | "mode": "php", | 75 | "mode": "php", |
81 | "extensions": [] | 76 | "extensions": [] |
77 | }, | ||
78 | "thumbnails": { | ||
79 | "enabled": true, | ||
80 | "width": 90, | ||
81 | "height": 53 | ||
82 | } | 82 | } |
83 | } | 83 | } |
84 | */ ?> \ No newline at end of file | 84 | */ ?> |