diff options
Diffstat (limited to 'tests/config/ConfigManagerTest.php')
-rw-r--r-- | tests/config/ConfigManagerTest.php | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/config/ConfigManagerTest.php b/tests/config/ConfigManagerTest.php index 1ec447b2..33830bc9 100644 --- a/tests/config/ConfigManagerTest.php +++ b/tests/config/ConfigManagerTest.php | |||
@@ -7,7 +7,7 @@ namespace Shaarli\Config; | |||
7 | * Note: it only test the manager with ConfigJson, | 7 | * Note: it only test the manager with ConfigJson, |
8 | * ConfigPhp is only a workaround to handle the transition to JSON type. | 8 | * ConfigPhp is only a workaround to handle the transition to JSON type. |
9 | */ | 9 | */ |
10 | class ConfigManagerTest extends \PHPUnit_Framework_TestCase | 10 | class ConfigManagerTest extends \PHPUnit\Framework\TestCase |
11 | { | 11 | { |
12 | /** | 12 | /** |
13 | * @var ConfigManager | 13 | * @var ConfigManager |
@@ -81,6 +81,18 @@ class ConfigManagerTest extends \PHPUnit_Framework_TestCase | |||
81 | $this->assertEquals('testSetWriteGetNested', $this->conf->get('foo.bar.key.stuff')); | 81 | $this->assertEquals('testSetWriteGetNested', $this->conf->get('foo.bar.key.stuff')); |
82 | } | 82 | } |
83 | 83 | ||
84 | public function testSetDeleteNested() | ||
85 | { | ||
86 | $this->conf->set('foo.bar.key.stuff', 'testSetDeleteNested'); | ||
87 | $this->assertTrue($this->conf->exists('foo.bar')); | ||
88 | $this->assertTrue($this->conf->exists('foo.bar.key.stuff')); | ||
89 | $this->assertEquals('testSetDeleteNested', $this->conf->get('foo.bar.key.stuff')); | ||
90 | |||
91 | $this->conf->remove('foo.bar'); | ||
92 | $this->assertFalse($this->conf->exists('foo.bar.key.stuff')); | ||
93 | $this->assertFalse($this->conf->exists('foo.bar')); | ||
94 | } | ||
95 | |||
84 | /** | 96 | /** |
85 | * Set with an empty key. | 97 | * Set with an empty key. |
86 | * | 98 | * |
@@ -104,6 +116,17 @@ class ConfigManagerTest extends \PHPUnit_Framework_TestCase | |||
104 | } | 116 | } |
105 | 117 | ||
106 | /** | 118 | /** |
119 | * Remove with an empty key. | ||
120 | * | ||
121 | * @expectedException \Exception | ||
122 | * @expectedExceptionMessageRegExp #^Invalid setting key parameter. String expected, got.*# | ||
123 | */ | ||
124 | public function testRmoveEmptyKey() | ||
125 | { | ||
126 | $this->conf->remove(''); | ||
127 | } | ||
128 | |||
129 | /** | ||
107 | * Try to write the config without mandatory parameter (e.g. 'login'). | 130 | * Try to write the config without mandatory parameter (e.g. 'login'). |
108 | * | 131 | * |
109 | * @expectedException Shaarli\Config\Exception\MissingFieldConfigException | 132 | * @expectedException Shaarli\Config\Exception\MissingFieldConfigException |