Skip to content
Permalink
Browse files

Adding a parameter to configured() to allow you to check if a particu…

…lar config has been configured.
  • Loading branch information...
markstory committed Dec 5, 2010
1 parent 0b18fc2 commit 5ad8d8af41b7ca1b4b7b6198a1914e949518d0ff
Showing with 8 additions and 1 deletion.
  1. +4 −1 cake/libs/configure.php
  2. +4 −0 cake/tests/cases/libs/configure.test.php
@@ -284,7 +284,10 @@ public static function config($name, ConfigReaderInterface $reader) {
*
* @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 @@ function testReaderSetup() {
$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.');
}

0 comments on commit 5ad8d8a

Please sign in to comment.
You can’t perform that action at this time.