Add Configure::clear()

Refs #2767
This commit is contained in:
mark_story 2012-04-14 23:31:26 -04:00
parent 072aee0a0f
commit f990ecfff3
2 changed files with 20 additions and 0 deletions

View file

@ -326,6 +326,15 @@ class Configure {
return false;
}
/**
* Clear all values stored in Configure.
*
* @return boolean success.
*/
public static function clear() {
self::$_values = array();
return true;
}
/**
* Set the error and exception handlers.
*

View file

@ -354,4 +354,15 @@ class ConfigureTest extends CakeTestCase {
Configure::config('test', $reader);
}
/**
* Test that clear wipes all values.
*
* @return void
*/
public function testClear() {
Configure::write('test', 'value');
$this->assertTrue(Configure::clear());
$this->assertNull(Configure::read('debug'));
$this->assertNull(Configure::read('test'));
}
}