Skip to content

Commit

Permalink
Adding a parameter to configured() to allow you to check if a particu…
Browse files Browse the repository at this point in the history
…lar config has been configured.
  • Loading branch information
markstory committed Dec 5, 2010
1 parent 0b18fc2 commit 5ad8d8a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cake/libs/configure.php
Expand Up @@ -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);
}

Expand Down
4 changes: 4 additions & 0 deletions cake/tests/cases/libs/configure.test.php
Expand Up @@ -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.');
}
Expand Down

0 comments on commit 5ad8d8a

Please sign in to comment.