diff --git a/cake/libs/configure.php b/cake/libs/configure.php index 0a9ee2993..99b6bebad 100644 --- a/cake/libs/configure.php +++ b/cake/libs/configure.php @@ -247,7 +247,7 @@ class Configure extends Object { function write($config, $value = null) { $_this =& Configure::getInstance(); - if (!is_array($config) && $value !== null) { + if (!is_array($config)) { $config = array($config => $value); } diff --git a/cake/tests/cases/libs/configure.test.php b/cake/tests/cases/libs/configure.test.php index e2010322f..d737ddd46 100644 --- a/cake/tests/cases/libs/configure.test.php +++ b/cake/tests/cases/libs/configure.test.php @@ -60,7 +60,7 @@ class ConfigureTest extends UnitTestCase { $result = $this->Configure->listObjects('helper'); $this->assertTrue(in_array('Html', $result)); } - + function testRead() { $expected = 'ok'; @@ -82,6 +82,16 @@ class ConfigureTest extends UnitTestCase { } } + function testWriteConfig() { + $this->Configure->write('SomeName.someKey', 'myvalue'); + $result = $this->Configure->read('SomeName.someKey'); + $this->assertEqual($result, 'myvalue'); + + $this->Configure->write('SomeName.someKey', null); + $result = $this->Configure->read('SomeName.someKey'); + $this->assertEqual($result, null); + } + function tearDown() { unset($this->Configure); if (file_exists(TMP . 'cache' . DS . 'persistent' . DS . 'cake_core_core_paths')) {