From f990ecfff3ed95d5dbb69ffb84d4b951a6abc796 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sat, 14 Apr 2012 23:31:26 -0400 Subject: [PATCH] Add Configure::clear() Refs #2767 --- lib/Cake/Core/Configure.php | 9 +++++++++ lib/Cake/Test/Case/Core/ConfigureTest.php | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/lib/Cake/Core/Configure.php b/lib/Cake/Core/Configure.php index 9d47dd759..45e60fd2d 100644 --- a/lib/Cake/Core/Configure.php +++ b/lib/Cake/Core/Configure.php @@ -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. * diff --git a/lib/Cake/Test/Case/Core/ConfigureTest.php b/lib/Cake/Test/Case/Core/ConfigureTest.php index 9a73a1e7c..ec462d6f7 100644 --- a/lib/Cake/Test/Case/Core/ConfigureTest.php +++ b/lib/Cake/Test/Case/Core/ConfigureTest.php @@ -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')); + } }