Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add Configure::clear()

Refs #2767
  • Loading branch information...
commit f990ecfff3ed95d5dbb69ffb84d4b951a6abc796 1 parent 072aee0
Mark Story markstory authored
9 lib/Cake/Core/Configure.php
View
@@ -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.
11 lib/Cake/Test/Case/Core/ConfigureTest.php
View
@@ -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'));
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.