-
Notifications
You must be signed in to change notification settings - Fork 134
Open
Description
Method \Noodlehaus\AbstractConfig::offsetUnset (Deletes a key and its value) does not remove the key from the configuration but only set the value of the key to null.
The following code:
$config = new \Noodlehaus\Config('tests/mocks/pass/config.ini');
print_r($config->all());
$config->offsetUnset('application');
print_r($config->all());
yields the following output:
Array
(
[host] => localhost
[port] => 80
[servers] => Array
(
[0] => host1
[1] => host2
[2] => host3
)
[application] => Array
(
[name] => configuration
[secret] => s3cr3t
)
)
Array
(
[host] => localhost
[port] => 80
[servers] => Array
(
[0] => host1
[1] => host2
[2] => host3
)
[application] =>
)
The key application is still in the configuration (with value null).
Unit test \Noodlehaus\AbstractConfigTest\testRemove must use assertArrayNotHasKey instead of assertNull:
public function testRemove()
{
$this->config->remove('application');
$this->assertArrayNotHasKey('application', $this->config->all());
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels