aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Updater/UpdaterTest.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2018-06-08 12:50:49 +0200
committerArthurHoaro <arthur@hoa.ro>2018-07-05 20:34:22 +0200
commit28f26524609338316cc6e51c743058e6e8c7b12b (patch)
treee03f1e5dde3779a47a682cf1461151fbd687e4bb /tests/Updater/UpdaterTest.php
parent787faa42f3a2bcbf83a7853f23f3667a6febf9da (diff)
downloadShaarli-28f26524609338316cc6e51c743058e6e8c7b12b.tar.gz
Shaarli-28f26524609338316cc6e51c743058e6e8c7b12b.tar.zst
Shaarli-28f26524609338316cc6e51c743058e6e8c7b12b.zip
Add a page to update all thumbnails through AJAX requests in both templates
Diffstat (limited to 'tests/Updater/UpdaterTest.php')
-rw-r--r--tests/Updater/UpdaterTest.php40
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}