diff --git a/lib/Cake/Core/Configure.php b/lib/Cake/Core/Configure.php index c778fc0be..88eedfd51 100644 --- a/lib/Cake/Core/Configure.php +++ b/lib/Cake/Core/Configure.php @@ -179,7 +179,7 @@ class Configure { * Configure::read('Name.key'); will return only the value of Configure::Name[key] * }}} * - * @param string $var Variable to obtain. Use '.' to access array elements. + * @param string|null $var Variable to obtain. Use '.' to access array elements. * @return mixed value stored in configure, or null. * @link http://book.cakephp.org/2.0/en/development/configuration.html#Configure::read */ @@ -220,7 +220,7 @@ class Configure { * @param string $var Variable name to check for * @return bool True if variable is there */ - public static function check($var = null) { + public static function check($var) { if (empty($var)) { return false; } @@ -240,7 +240,7 @@ class Configure { * @return void * @link http://book.cakephp.org/2.0/en/development/configuration.html#Configure::delete */ - public static function delete($var = null) { + public static function delete($var) { self::$_values = Hash::remove(self::$_values, $var); } @@ -265,7 +265,7 @@ class Configure { /** * Gets the names of the configured reader objects. * - * @param string $name Name to check. If null returns all configured reader names. + * @param string|null $name Name to check. If null returns all configured reader names. * @return array Array of the configured reader objects. */ public static function configured($name = null) { @@ -443,7 +443,7 @@ class Configure { /** * Clear all values stored in Configure. * - * @return bool success. + * @return bool Success. */ public static function clear() { self::$_values = array(); diff --git a/lib/Cake/Test/Case/Core/ConfigureTest.php b/lib/Cake/Test/Case/Core/ConfigureTest.php index 435e6b310..d8837b948 100644 --- a/lib/Cake/Test/Case/Core/ConfigureTest.php +++ b/lib/Cake/Test/Case/Core/ConfigureTest.php @@ -168,6 +168,19 @@ class ConfigureTest extends CakeTestCase { $this->assertEquals($expected, $result); } + /** + * testConsumeEmpty + * + * @return void + */ + public function testConsumeEmpty() { + Configure::write('Test', array('key' => 'value', 'key2' => 'value2')); + $result = Configure::consume(''); + $this->assertNull($result); + $result = Configure::consume(null); + $this->assertNull($result); + } + /** * test setting display_errors with debug. * @@ -195,7 +208,7 @@ class ConfigureTest extends CakeTestCase { Configure::delete('SomeName.someKey'); $result = Configure::read('SomeName.someKey'); - $this->assertTrue($result === null); + $this->assertNull($result); Configure::write('SomeName', array('someKey' => 'myvalue', 'otherKey' => 'otherValue')); @@ -208,10 +221,10 @@ class ConfigureTest extends CakeTestCase { Configure::delete('SomeName'); $result = Configure::read('SomeName.someKey'); - $this->assertTrue($result === null); + $this->assertNull($result); $result = Configure::read('SomeName.otherKey'); - $this->assertTrue($result === null); + $this->assertNull($result); } /** @@ -265,7 +278,8 @@ class ConfigureTest extends CakeTestCase { * @return void */ public function testCheckEmpty() { - $this->assertFalse(Configure::check()); + $this->assertFalse(Configure::check('')); + $this->assertFalse(Configure::check(null)); } /**