X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2Fconfig%2FConfigManagerTest.php;h=4a4e94ac551f135cca96d81a7f08672c43bae7ef;hb=a3724717ec37d4bd54dc117ef439c8a182157882;hp=1ec447b23aeab9bfbe31b847e9731cfa780db617;hpb=1b93137e16694f52952c930848e1a7928e8a00a6;p=github%2Fshaarli%2FShaarli.git diff --git a/tests/config/ConfigManagerTest.php b/tests/config/ConfigManagerTest.php index 1ec447b2..4a4e94ac 100644 --- a/tests/config/ConfigManagerTest.php +++ b/tests/config/ConfigManagerTest.php @@ -81,6 +81,18 @@ class ConfigManagerTest extends \PHPUnit_Framework_TestCase $this->assertEquals('testSetWriteGetNested', $this->conf->get('foo.bar.key.stuff')); } + public function testSetDeleteNested() + { + $this->conf->set('foo.bar.key.stuff', 'testSetDeleteNested'); + $this->assertTrue($this->conf->exists('foo.bar')); + $this->assertTrue($this->conf->exists('foo.bar.key.stuff')); + $this->assertEquals('testSetDeleteNested', $this->conf->get('foo.bar.key.stuff')); + + $this->conf->remove('foo.bar'); + $this->assertFalse($this->conf->exists('foo.bar.key.stuff')); + $this->assertFalse($this->conf->exists('foo.bar')); + } + /** * Set with an empty key. * @@ -103,6 +115,17 @@ class ConfigManagerTest extends \PHPUnit_Framework_TestCase $this->conf->set(array('foo' => 'bar'), 'stuff'); } + /** + * Remove with an empty key. + * + * @expectedException \Exception + * @expectedExceptionMessageRegExp #^Invalid setting key parameter. String expected, got.*# + */ + public function testRmoveEmptyKey() + { + $this->conf->remove(''); + } + /** * Try to write the config without mandatory parameter (e.g. 'login'). *