mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Adding a parameter to configured() to allow you to check if a particular config has been configured.
This commit is contained in:
parent
0b18fc25a6
commit
5ad8d8af41
2 changed files with 8 additions and 1 deletions
|
@ -284,7 +284,10 @@ class Configure {
|
|||
*
|
||||
* @return array Array of the configured reader objects.
|
||||
*/
|
||||
public static function configured() {
|
||||
public static function configured($name = null) {
|
||||
if ($name) {
|
||||
return isset(self::$_readers[$name]);
|
||||
}
|
||||
return array_keys(self::$_readers);
|
||||
}
|
||||
|
||||
|
|
|
@ -294,6 +294,10 @@ class ConfigureTest extends CakeTestCase {
|
|||
$configured = Configure::configured();
|
||||
|
||||
$this->assertTrue(in_array('test', $configured));
|
||||
|
||||
$this->assertTrue(Configure::configured('test'));
|
||||
$this->assertFalse(Configure::configured('fake_garbage'));
|
||||
|
||||
$this->assertTrue(Configure::drop('test'));
|
||||
$this->assertFalse(Configure::drop('test'), 'dropping things that do not exist should return false.');
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue