diff options
author | ArthurHoaro <arthur@hoa.ro> | 2016-05-18 21:48:24 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2016-06-11 09:30:56 +0200 |
commit | 684e662a58b02bde225e44d3677987b6fc3adf0b (patch) | |
tree | db0d4ca1d9b53341cc108b0e7671ffde0e9caee9 /tests/ApplicationUtilsTest.php | |
parent | 59404d7909b21682ec0782778452a8a70e38b25e (diff) | |
download | Shaarli-684e662a58b02bde225e44d3677987b6fc3adf0b.tar.gz Shaarli-684e662a58b02bde225e44d3677987b6fc3adf0b.tar.zst Shaarli-684e662a58b02bde225e44d3677987b6fc3adf0b.zip |
Replace $GLOBALS configuration with the configuration manager in the whole code base
Diffstat (limited to 'tests/ApplicationUtilsTest.php')
-rw-r--r-- | tests/ApplicationUtilsTest.php | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/tests/ApplicationUtilsTest.php b/tests/ApplicationUtilsTest.php index 6064357d..cf82b655 100644 --- a/tests/ApplicationUtilsTest.php +++ b/tests/ApplicationUtilsTest.php | |||
@@ -3,6 +3,7 @@ | |||
3 | * ApplicationUtils' tests | 3 | * ApplicationUtils' tests |
4 | */ | 4 | */ |
5 | 5 | ||
6 | require_once 'application/config/ConfigManager.php'; | ||
6 | require_once 'application/ApplicationUtils.php'; | 7 | require_once 'application/ApplicationUtils.php'; |
7 | 8 | ||
8 | /** | 9 | /** |
@@ -59,7 +60,7 @@ class ApplicationUtilsTest extends PHPUnit_Framework_TestCase | |||
59 | $testTimeout | 60 | $testTimeout |
60 | ) | 61 | ) |
61 | ); | 62 | ); |
62 | $this->assertRegexp( | 63 | $this->assertRegExp( |
63 | self::$versionPattern, | 64 | self::$versionPattern, |
64 | ApplicationUtils::getLatestGitVersionCode( | 65 | ApplicationUtils::getLatestGitVersionCode( |
65 | 'https://raw.githubusercontent.com/shaarli/Shaarli/' | 66 | 'https://raw.githubusercontent.com/shaarli/Shaarli/' |
@@ -275,21 +276,21 @@ class ApplicationUtilsTest extends PHPUnit_Framework_TestCase | |||
275 | */ | 276 | */ |
276 | public function testCheckCurrentResourcePermissions() | 277 | public function testCheckCurrentResourcePermissions() |
277 | { | 278 | { |
278 | $config = array( | 279 | $conf = ConfigManager::getInstance(); |
279 | 'CACHEDIR' => 'cache', | 280 | $conf->set('config.CACHEDIR', 'cache'); |
280 | 'CONFIG_FILE' => 'data/config.php', | 281 | $conf->set('config.CONFIG_FILE', 'data/config.php'); |
281 | 'DATADIR' => 'data', | 282 | $conf->set('config.DATADIR', 'data'); |
282 | 'DATASTORE' => 'data/datastore.php', | 283 | $conf->set('config.DATASTORE', 'data/datastore.php'); |
283 | 'IPBANS_FILENAME' => 'data/ipbans.php', | 284 | $conf->set('config.IPBANS_FILENAME', 'data/ipbans.php'); |
284 | 'LOG_FILE' => 'data/log.txt', | 285 | $conf->set('config.LOG_FILE', 'data/log.txt'); |
285 | 'PAGECACHE' => 'pagecache', | 286 | $conf->set('config.PAGECACHE', 'pagecache'); |
286 | 'RAINTPL_TMP' => 'tmp', | 287 | $conf->set('config.RAINTPL_TMP', 'tmp'); |
287 | 'RAINTPL_TPL' => 'tpl', | 288 | $conf->set('config.RAINTPL_TPL', 'tpl'); |
288 | 'UPDATECHECK_FILENAME' => 'data/lastupdatecheck.txt' | 289 | $conf->set('config.UPDATECHECK_FILENAME', 'data/lastupdatecheck.txt'); |
289 | ); | 290 | |
290 | $this->assertEquals( | 291 | $this->assertEquals( |
291 | array(), | 292 | array(), |
292 | ApplicationUtils::checkResourcePermissions($config) | 293 | ApplicationUtils::checkResourcePermissions() |
293 | ); | 294 | ); |
294 | } | 295 | } |
295 | 296 | ||
@@ -298,18 +299,17 @@ class ApplicationUtilsTest extends PHPUnit_Framework_TestCase | |||
298 | */ | 299 | */ |
299 | public function testCheckCurrentResourcePermissionsErrors() | 300 | public function testCheckCurrentResourcePermissionsErrors() |
300 | { | 301 | { |
301 | $config = array( | 302 | $conf = ConfigManager::getInstance(); |
302 | 'CACHEDIR' => 'null/cache', | 303 | $conf->set('config.CACHEDIR', 'null/cache'); |
303 | 'CONFIG_FILE' => 'null/data/config.php', | 304 | $conf->set('config.CONFIG_FILE', 'null/data/config.php'); |
304 | 'DATADIR' => 'null/data', | 305 | $conf->set('config.DATADIR', 'null/data'); |
305 | 'DATASTORE' => 'null/data/store.php', | 306 | $conf->set('config.DATASTORE', 'null/data/store.php'); |
306 | 'IPBANS_FILENAME' => 'null/data/ipbans.php', | 307 | $conf->set('config.IPBANS_FILENAME', 'null/data/ipbans.php'); |
307 | 'LOG_FILE' => 'null/data/log.txt', | 308 | $conf->set('config.LOG_FILE', 'null/data/log.txt'); |
308 | 'PAGECACHE' => 'null/pagecache', | 309 | $conf->set('config.PAGECACHE', 'null/pagecache'); |
309 | 'RAINTPL_TMP' => 'null/tmp', | 310 | $conf->set('config.RAINTPL_TMP', 'null/tmp'); |
310 | 'RAINTPL_TPL' => 'null/tpl', | 311 | $conf->set('config.RAINTPL_TPL', 'null/tpl'); |
311 | 'UPDATECHECK_FILENAME' => 'null/data/lastupdatecheck.txt' | 312 | $conf->set('config.UPDATECHECK_FILENAME', 'null/data/lastupdatecheck.txt'); |
312 | ); | ||
313 | $this->assertEquals( | 313 | $this->assertEquals( |
314 | array( | 314 | array( |
315 | '"null/tpl" directory is not readable', | 315 | '"null/tpl" directory is not readable', |
@@ -322,7 +322,7 @@ class ApplicationUtilsTest extends PHPUnit_Framework_TestCase | |||
322 | '"null/tmp" directory is not readable', | 322 | '"null/tmp" directory is not readable', |
323 | '"null/tmp" directory is not writable' | 323 | '"null/tmp" directory is not writable' |
324 | ), | 324 | ), |
325 | ApplicationUtils::checkResourcePermissions($config) | 325 | ApplicationUtils::checkResourcePermissions() |
326 | ); | 326 | ); |
327 | } | 327 | } |
328 | } | 328 | } |