aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/config/ConfigManagerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/config/ConfigManagerTest.php')
-rw-r--r--tests/config/ConfigManagerTest.php48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/config/ConfigManagerTest.php b/tests/config/ConfigManagerTest.php
new file mode 100644
index 00000000..1b6358f3
--- /dev/null
+++ b/tests/config/ConfigManagerTest.php
@@ -0,0 +1,48 @@
1<?php
2
3/**
4 * Unit tests for Class ConfigManagerTest
5 *
6 * Note: it only test the manager with ConfigJson,
7 * ConfigPhp is only a workaround to handle the transition to JSON type.
8 */
9class ConfigManagerTest extends \PHPUnit_Framework_TestCase
10{
11 /**
12 * @var ConfigManager
13 */
14 protected $conf;
15
16 public function setUp()
17 {
18 ConfigManager::$CONFIG_FILE = 'tests/config/config';
19 $this->conf = ConfigManager::getInstance();
20 }
21
22 public function tearDown()
23 {
24 @unlink($this->conf->getConfigFile());
25 }
26
27 public function testSetWriteGet()
28 {
29 // This won't work with ConfigPhp.
30 $this->markTestIncomplete();
31
32 $this->conf->set('paramInt', 42);
33 $this->conf->set('paramString', 'value1');
34 $this->conf->set('paramBool', false);
35 $this->conf->set('paramArray', array('foo' => 'bar'));
36 $this->conf->set('paramNull', null);
37
38 $this->conf->write(true);
39 $this->conf->reload();
40
41 $this->assertEquals(42, $this->conf->get('paramInt'));
42 $this->assertEquals('value1', $this->conf->get('paramString'));
43 $this->assertFalse($this->conf->get('paramBool'));
44 $this->assertEquals(array('foo' => 'bar'), $this->conf->get('paramArray'));
45 $this->assertEquals(null, $this->conf->get('paramNull'));
46 }
47
48} \ No newline at end of file