X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2Fconfig%2FConfigManagerTest.php;h=33830bc94bcc3584380b1a18259e4cf9ec101980;hb=dea72c711ff740b3b829d238fcf85648465143a0;hp=b81be5b66064c845ea6aafba3defb79210bb8c24;hpb=236239be752a7bb24547237b5751ac4fcbc0e549;p=github%2Fshaarli%2FShaarli.git diff --git a/tests/config/ConfigManagerTest.php b/tests/config/ConfigManagerTest.php index b81be5b6..33830bc9 100644 --- a/tests/config/ConfigManagerTest.php +++ b/tests/config/ConfigManagerTest.php @@ -7,7 +7,7 @@ namespace Shaarli\Config; * Note: it only test the manager with ConfigJson, * ConfigPhp is only a workaround to handle the transition to JSON type. */ -class ConfigManagerTest extends \PHPUnit_Framework_TestCase +class ConfigManagerTest extends \PHPUnit\Framework\TestCase { /** * @var ConfigManager @@ -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,10 +115,21 @@ 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'). * - * @expectedException Shaarli\Config\MissingFieldConfigException + * @expectedException Shaarli\Config\Exception\MissingFieldConfigException */ public function testWriteMissingParameter() {