aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/config
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2016-05-18 21:48:24 +0200
committerArthurHoaro <arthur@hoa.ro>2016-06-11 09:30:56 +0200
commit684e662a58b02bde225e44d3677987b6fc3adf0b (patch)
treedb0d4ca1d9b53341cc108b0e7671ffde0e9caee9 /tests/config
parent59404d7909b21682ec0782778452a8a70e38b25e (diff)
downloadShaarli-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/config')
-rw-r--r--tests/config/ConfigPhpTest.php16
-rw-r--r--tests/config/php/configOK.php14
2 files changed, 8 insertions, 22 deletions
diff --git a/tests/config/ConfigPhpTest.php b/tests/config/ConfigPhpTest.php
index 0f849bd5..58cd8d2a 100644
--- a/tests/config/ConfigPhpTest.php
+++ b/tests/config/ConfigPhpTest.php
@@ -22,7 +22,7 @@ class ConfigPhpTest extends PHPUnit_Framework_TestCase
22 */ 22 */
23 public function testRead() 23 public function testRead()
24 { 24 {
25 $conf = $this->configIO->read('tests/config/php/configOK'); 25 $conf = $this->configIO->read('tests/utils/config/configPhp.php');
26 $this->assertEquals('root', $conf['login']); 26 $this->assertEquals('root', $conf['login']);
27 $this->assertEquals('lala', $conf['redirector']); 27 $this->assertEquals('lala', $conf['redirector']);
28 $this->assertEquals('data/datastore.php', $conf['config']['DATASTORE']); 28 $this->assertEquals('data/datastore.php', $conf['config']['DATASTORE']);
@@ -42,7 +42,7 @@ class ConfigPhpTest extends PHPUnit_Framework_TestCase
42 */ 42 */
43 public function testWriteNew() 43 public function testWriteNew()
44 { 44 {
45 $dataFile = 'tests/config/php/configWrite'; 45 $dataFile = 'tests/utils/config/configWrite.php';
46 $data = array( 46 $data = array(
47 'login' => 'root', 47 'login' => 'root',
48 'redirector' => 'lala', 48 'redirector' => 'lala',
@@ -60,8 +60,8 @@ $GLOBALS[\'redirector\'] = \'lala\';
60$GLOBALS[\'config\'][\'DATASTORE\'] = \'data/datastore.php\'; 60$GLOBALS[\'config\'][\'DATASTORE\'] = \'data/datastore.php\';
61$GLOBALS[\'plugins\'][\'WALLABAG_VERSION\'] = \'1\'; 61$GLOBALS[\'plugins\'][\'WALLABAG_VERSION\'] = \'1\';
62'; 62';
63 $this->assertEquals($expected, file_get_contents($dataFile .'.php')); 63 $this->assertEquals($expected, file_get_contents($dataFile));
64 unlink($dataFile .'.php'); 64 unlink($dataFile);
65 } 65 }
66 66
67 /** 67 /**
@@ -69,14 +69,14 @@ $GLOBALS[\'plugins\'][\'WALLABAG_VERSION\'] = \'1\';
69 */ 69 */
70 public function testOverwrite() 70 public function testOverwrite()
71 { 71 {
72 $source = 'tests/config/php/configOK.php'; 72 $source = 'tests/utils/config/configPhp.php';
73 $dest = 'tests/config/php/configOverwrite'; 73 $dest = 'tests/utils/config/configOverwrite.php';
74 copy($source, $dest . '.php'); 74 copy($source, $dest);
75 $conf = $this->configIO->read($dest); 75 $conf = $this->configIO->read($dest);
76 $conf['redirector'] = 'blabla'; 76 $conf['redirector'] = 'blabla';
77 $this->configIO->write($dest, $conf); 77 $this->configIO->write($dest, $conf);
78 $conf = $this->configIO->read($dest); 78 $conf = $this->configIO->read($dest);
79 $this->assertEquals('blabla', $conf['redirector']); 79 $this->assertEquals('blabla', $conf['redirector']);
80 unlink($dest .'.php'); 80 unlink($dest);
81 } 81 }
82} 82}
diff --git a/tests/config/php/configOK.php b/tests/config/php/configOK.php
deleted file mode 100644
index b91ad293..00000000
--- a/tests/config/php/configOK.php
+++ /dev/null
@@ -1,14 +0,0 @@
1<?php
2$GLOBALS['login'] = 'root';
3$GLOBALS['hash'] = 'hash';
4$GLOBALS['salt'] = 'salt';
5$GLOBALS['timezone'] = 'Europe/Paris';
6$GLOBALS['title'] = 'BIGBANG';
7$GLOBALS['titleLink'] = '?';
8$GLOBALS['redirector'] = 'lala';
9$GLOBALS['disablesessionprotection'] = false;
10$GLOBALS['privateLinkByDefault'] = true;
11$GLOBALS['config']['DATADIR'] = 'data';
12$GLOBALS['config']['DATASTORE'] = 'data/datastore.php';
13$GLOBALS['plugins']['WALLABAG_URL'] = 'ghf';
14$GLOBALS['plugins']['WALLABAG_VERSION'] = '1'; \ No newline at end of file