aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/ConfigTest.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2016-01-12 19:50:48 +0100
committerArthurHoaro <arthur@hoa.ro>2016-02-15 20:30:24 +0100
commit510377d2cb4b12d1a421e8a88bd7edb86f223451 (patch)
tree6cea29c199fc1b29ccfb78f902313019f6f9d95e /tests/ConfigTest.php
parent268a2e52659964fb7d033a1bb4d1490bf8cc49bf (diff)
downloadShaarli-510377d2cb4b12d1a421e8a88bd7edb86f223451.tar.gz
Shaarli-510377d2cb4b12d1a421e8a88bd7edb86f223451.tar.zst
Shaarli-510377d2cb4b12d1a421e8a88bd7edb86f223451.zip
Introduce the Updater class which
* contains methods designed to be run once. * is able to upgrade the datastore or the configuration. * is based on methods names, stored in a text file with ';' separator (updates.txt). * begins with existing function 'mergeDeprecatedConfigFile()' (options.php).
Diffstat (limited to 'tests/ConfigTest.php')
-rw-r--r--tests/ConfigTest.php42
1 files changed, 0 insertions, 42 deletions
diff --git a/tests/ConfigTest.php b/tests/ConfigTest.php
index 492ddd3b..7200aae6 100644
--- a/tests/ConfigTest.php
+++ b/tests/ConfigTest.php
@@ -134,48 +134,6 @@ class ConfigTest extends PHPUnit_Framework_TestCase
134 } 134 }
135 135
136 /** 136 /**
137 * Test mergeDeprecatedConfig while being logged in:
138 * 1. init a config file.
139 * 2. init a options.php file with update value.
140 * 3. merge.
141 * 4. check updated value in config file.
142 */
143 public function testMergeDeprecatedConfig()
144 {
145 // init
146 writeConfig(self::$configFields, true);
147 $configCopy = self::$configFields;
148 $invert = !$configCopy['privateLinkByDefault'];
149 $configCopy['privateLinkByDefault'] = $invert;
150
151 // Use writeConfig to create a options.php
152 $configCopy['config']['CONFIG_FILE'] = 'tests/options.php';
153 writeConfig($configCopy, true);
154
155 $this->assertTrue(is_file($configCopy['config']['CONFIG_FILE']));
156
157 // merge configs
158 mergeDeprecatedConfig(self::$configFields, true);
159
160 // make sure updated field is changed
161 include self::$configFields['config']['CONFIG_FILE'];
162 $this->assertEquals($invert, $GLOBALS['privateLinkByDefault']);
163 $this->assertFalse(is_file($configCopy['config']['CONFIG_FILE']));
164 }
165
166 /**
167 * Test mergeDeprecatedConfig while being logged in without options file.
168 */
169 public function testMergeDeprecatedConfigNoFile()
170 {
171 writeConfig(self::$configFields, true);
172 mergeDeprecatedConfig(self::$configFields, true);
173
174 include self::$configFields['config']['CONFIG_FILE'];
175 $this->assertEquals(self::$configFields['login'], $GLOBALS['login']);
176 }
177
178 /**
179 * Test save_plugin_config with valid data. 137 * Test save_plugin_config with valid data.
180 * 138 *
181 * @throws PluginConfigOrderException 139 * @throws PluginConfigOrderException