mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Backport of 3.0 Configure corrections.
This commit is contained in:
parent
4cd2c8fdcb
commit
b936a34471
2 changed files with 23 additions and 9 deletions
|
@ -179,7 +179,7 @@ class Configure {
|
||||||
* Configure::read('Name.key'); will return only the value of Configure::Name[key]
|
* 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.
|
* @return mixed value stored in configure, or null.
|
||||||
* @link http://book.cakephp.org/2.0/en/development/configuration.html#Configure::read
|
* @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
|
* @param string $var Variable name to check for
|
||||||
* @return bool True if variable is there
|
* @return bool True if variable is there
|
||||||
*/
|
*/
|
||||||
public static function check($var = null) {
|
public static function check($var) {
|
||||||
if (empty($var)) {
|
if (empty($var)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -240,7 +240,7 @@ class Configure {
|
||||||
* @return void
|
* @return void
|
||||||
* @link http://book.cakephp.org/2.0/en/development/configuration.html#Configure::delete
|
* @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);
|
self::$_values = Hash::remove(self::$_values, $var);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ class Configure {
|
||||||
/**
|
/**
|
||||||
* Gets the names of the configured reader objects.
|
* 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.
|
* @return array Array of the configured reader objects.
|
||||||
*/
|
*/
|
||||||
public static function configured($name = null) {
|
public static function configured($name = null) {
|
||||||
|
@ -443,7 +443,7 @@ class Configure {
|
||||||
/**
|
/**
|
||||||
* Clear all values stored in Configure.
|
* Clear all values stored in Configure.
|
||||||
*
|
*
|
||||||
* @return bool success.
|
* @return bool Success.
|
||||||
*/
|
*/
|
||||||
public static function clear() {
|
public static function clear() {
|
||||||
self::$_values = array();
|
self::$_values = array();
|
||||||
|
|
|
@ -168,6 +168,19 @@ class ConfigureTest extends CakeTestCase {
|
||||||
$this->assertEquals($expected, $result);
|
$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.
|
* test setting display_errors with debug.
|
||||||
*
|
*
|
||||||
|
@ -195,7 +208,7 @@ class ConfigureTest extends CakeTestCase {
|
||||||
|
|
||||||
Configure::delete('SomeName.someKey');
|
Configure::delete('SomeName.someKey');
|
||||||
$result = Configure::read('SomeName.someKey');
|
$result = Configure::read('SomeName.someKey');
|
||||||
$this->assertTrue($result === null);
|
$this->assertNull($result);
|
||||||
|
|
||||||
Configure::write('SomeName', array('someKey' => 'myvalue', 'otherKey' => 'otherValue'));
|
Configure::write('SomeName', array('someKey' => 'myvalue', 'otherKey' => 'otherValue'));
|
||||||
|
|
||||||
|
@ -208,10 +221,10 @@ class ConfigureTest extends CakeTestCase {
|
||||||
Configure::delete('SomeName');
|
Configure::delete('SomeName');
|
||||||
|
|
||||||
$result = Configure::read('SomeName.someKey');
|
$result = Configure::read('SomeName.someKey');
|
||||||
$this->assertTrue($result === null);
|
$this->assertNull($result);
|
||||||
|
|
||||||
$result = Configure::read('SomeName.otherKey');
|
$result = Configure::read('SomeName.otherKey');
|
||||||
$this->assertTrue($result === null);
|
$this->assertNull($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -265,7 +278,8 @@ class ConfigureTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testCheckEmpty() {
|
public function testCheckEmpty() {
|
||||||
$this->assertFalse(Configure::check());
|
$this->assertFalse(Configure::check(''));
|
||||||
|
$this->assertFalse(Configure::check(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue