ConfigManager: add a method to remove an entry
This commit is contained in:
parent
1b93137e16
commit
a3724717ec
2 changed files with 72 additions and 1 deletions
tests/config
|
@ -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').
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue