aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Updater/UpdaterTest.php45
-rw-r--r--tests/config/ConfigJsonTest.php2
2 files changed, 46 insertions, 1 deletions
diff --git a/tests/Updater/UpdaterTest.php b/tests/Updater/UpdaterTest.php
index b522d616..11b6444a 100644
--- a/tests/Updater/UpdaterTest.php
+++ b/tests/Updater/UpdaterTest.php
@@ -615,4 +615,49 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
615 $this->assertTrue($updater->updateMethodPiwikUrl()); 615 $this->assertTrue($updater->updateMethodPiwikUrl());
616 $this->assertEquals($url, $this->conf->get('plugins.PIWIK_URL')); 616 $this->assertEquals($url, $this->conf->get('plugins.PIWIK_URL'));
617 } 617 }
618
619 /**
620 * Test updateMethodAtomDefault with show_atom set to false
621 * => update to true.
622 */
623 public function testUpdateMethodAtomDefault()
624 {
625 $sandboxConf = 'sandbox/config';
626 copy(self::$configFile . '.json.php', $sandboxConf . '.json.php');
627 $this->conf = new ConfigManager($sandboxConf);
628 $this->conf->set('feed.show_atom', false);
629 $updater = new Updater([], [], $this->conf, true);
630 $this->assertTrue($updater->updateMethodAtomDefault());
631 $this->assertTrue($this->conf->get('feed.show_atom'));
632 // reload from file
633 $this->conf = new ConfigManager($sandboxConf);
634 $this->assertTrue($this->conf->get('feed.show_atom'));
635 }
636 /**
637 * Test updateMethodAtomDefault with show_atom not set.
638 * => nothing to do
639 */
640 public function testUpdateMethodAtomDefaultNoExist()
641 {
642 $sandboxConf = 'sandbox/config';
643 copy(self::$configFile . '.json.php', $sandboxConf . '.json.php');
644 $this->conf = new ConfigManager($sandboxConf);
645 $updater = new Updater([], [], $this->conf, true);
646 $this->assertTrue($updater->updateMethodAtomDefault());
647 $this->assertTrue($this->conf->get('feed.show_atom'));
648 }
649 /**
650 * Test updateMethodAtomDefault with show_atom set to true.
651 * => nothing to do
652 */
653 public function testUpdateMethodAtomDefaultAlreadyTrue()
654 {
655 $sandboxConf = 'sandbox/config';
656 copy(self::$configFile . '.json.php', $sandboxConf . '.json.php');
657 $this->conf = new ConfigManager($sandboxConf);
658 $this->conf->set('feed.show_atom', true);
659 $updater = new Updater([], [], $this->conf, true);
660 $this->assertTrue($updater->updateMethodAtomDefault());
661 $this->assertTrue($this->conf->get('feed.show_atom'));
662 }
618} 663}
diff --git a/tests/config/ConfigJsonTest.php b/tests/config/ConfigJsonTest.php
index 3527f83d..d237bc80 100644
--- a/tests/config/ConfigJsonTest.php
+++ b/tests/config/ConfigJsonTest.php
@@ -40,7 +40,7 @@ class ConfigJsonTest extends \PHPUnit_Framework_TestCase
40 * Read a non existent config file -> empty array. 40 * Read a non existent config file -> empty array.
41 * 41 *
42 * @expectedException \Exception 42 * @expectedException \Exception
43 * @expectedExceptionMessage An error occurred while parsing JSON file: error code #4 43 * @expectedExceptionMessageRegExp /An error occurred while parsing JSON configuration file \([\w\/\.]+\): error code #4/
44 */ 44 */
45 public function testReadInvalidJson() 45 public function testReadInvalidJson()
46 { 46 {