Permalink
Browse files

Add Configure::clear()

Refs #2767
  • Loading branch information...
1 parent 072aee0 commit f990ecfff3ed95d5dbb69ffb84d4b951a6abc796 @markstory markstory committed Apr 15, 2012
Showing with 20 additions and 0 deletions.
  1. +9 −0 lib/Cake/Core/Configure.php
  2. +11 −0 lib/Cake/Test/Case/Core/ConfigureTest.php
View
9 lib/Cake/Core/Configure.php
@@ -327,6 +327,15 @@ public static function restore($name, $cacheConfig = 'default') {
}
/**
+ * Clear all values stored in Configure.
+ *
+ * @return boolean success.
+ */
+ public static function clear() {
+ self::$_values = array();
+ return true;
+ }
+/**
* Set the error and exception handlers.
*
* @param array $error The Error handling configuration.
View
11 lib/Cake/Test/Case/Core/ConfigureTest.php
@@ -354,4 +354,15 @@ public function testReaderExceptionOnIncorrectClass() {
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'));
+ }
}

0 comments on commit f990ecf

Please sign in to comment.