aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/ApplicationUtilsTest.php
diff options
context:
space:
mode:
authorArthur <arthur@hoa.ro>2016-07-09 07:19:48 +0200
committerGitHub <noreply@github.com>2016-07-09 07:19:48 +0200
commit649af5b501d2a90448242f53764ff693e9854039 (patch)
tree23cde80a7ee2949e552c48939ae22fa462cfa0fc /tests/ApplicationUtilsTest.php
parenta9cfa38df92bd2e1e2c00a67b6ac1516a2116ade (diff)
parent5ff23f02b80ec6ddee28dee869171ee8e3656b7c (diff)
downloadShaarli-649af5b501d2a90448242f53764ff693e9854039.tar.gz
Shaarli-649af5b501d2a90448242f53764ff693e9854039.tar.zst
Shaarli-649af5b501d2a90448242f53764ff693e9854039.zip
Merge pull request #570 from ArthurHoaro/config-manager
Introduce a configuration manager
Diffstat (limited to 'tests/ApplicationUtilsTest.php')
-rw-r--r--tests/ApplicationUtilsTest.php54
1 files changed, 27 insertions, 27 deletions
diff --git a/tests/ApplicationUtilsTest.php b/tests/ApplicationUtilsTest.php
index 6064357d..c37a94f0 100644
--- a/tests/ApplicationUtilsTest.php
+++ b/tests/ApplicationUtilsTest.php
@@ -3,6 +3,7 @@
3 * ApplicationUtils' tests 3 * ApplicationUtils' tests
4 */ 4 */
5 5
6require_once 'application/config/ConfigManager.php';
6require_once 'application/ApplicationUtils.php'; 7require_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 = new ConfigManager('');
279 'CACHEDIR' => 'cache', 280 $conf->set('resource.thumbnails_cache', 'cache');
280 'CONFIG_FILE' => 'data/config.php', 281 $conf->set('resource.config', 'data/config.php');
281 'DATADIR' => 'data', 282 $conf->set('resource.data_dir', 'data');
282 'DATASTORE' => 'data/datastore.php', 283 $conf->set('resource.datastore', 'data/datastore.php');
283 'IPBANS_FILENAME' => 'data/ipbans.php', 284 $conf->set('resource.ban_file', 'data/ipbans.php');
284 'LOG_FILE' => 'data/log.txt', 285 $conf->set('resource.log', 'data/log.txt');
285 'PAGECACHE' => 'pagecache', 286 $conf->set('resource.page_cache', 'pagecache');
286 'RAINTPL_TMP' => 'tmp', 287 $conf->set('resource.raintpl_tmp', 'tmp');
287 'RAINTPL_TPL' => 'tpl', 288 $conf->set('resource.raintpl_tpl', 'tpl');
288 'UPDATECHECK_FILENAME' => 'data/lastupdatecheck.txt' 289 $conf->set('resource.update_check', 'data/lastupdatecheck.txt');
289 ); 290
290 $this->assertEquals( 291 $this->assertEquals(
291 array(), 292 array(),
292 ApplicationUtils::checkResourcePermissions($config) 293 ApplicationUtils::checkResourcePermissions($conf)
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 = new ConfigManager('');
302 'CACHEDIR' => 'null/cache', 303 $conf->set('resource.thumbnails_cache', 'null/cache');
303 'CONFIG_FILE' => 'null/data/config.php', 304 $conf->set('resource.config', 'null/data/config.php');
304 'DATADIR' => 'null/data', 305 $conf->set('resource.data_dir', 'null/data');
305 'DATASTORE' => 'null/data/store.php', 306 $conf->set('resource.datastore', 'null/data/store.php');
306 'IPBANS_FILENAME' => 'null/data/ipbans.php', 307 $conf->set('resource.ban_file', 'null/data/ipbans.php');
307 'LOG_FILE' => 'null/data/log.txt', 308 $conf->set('resource.log', 'null/data/log.txt');
308 'PAGECACHE' => 'null/pagecache', 309 $conf->set('resource.page_cache', 'null/pagecache');
309 'RAINTPL_TMP' => 'null/tmp', 310 $conf->set('resource.raintpl_tmp', 'null/tmp');
310 'RAINTPL_TPL' => 'null/tpl', 311 $conf->set('resource.raintpl_tpl', 'null/tpl');
311 'UPDATECHECK_FILENAME' => 'null/data/lastupdatecheck.txt' 312 $conf->set('resource.update_check', '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($conf)
326 ); 326 );
327 } 327 }
328} 328}