From 89185ace25d365669c0daf62f9970cb3c60b4a23 Mon Sep 17 00:00:00 2001 From: phpnut Date: Mon, 22 Oct 2007 20:58:55 +0000 Subject: [PATCH] Adding ClassRegistry::flush() to reset the registry git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5868 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/class_registry.php | 10 ++++++++++ cake/tests/cases/libs/model/model.test.php | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/cake/libs/class_registry.php b/cake/libs/class_registry.php index 00d0b6e83..b4134df40 100644 --- a/cake/libs/class_registry.php +++ b/cake/libs/class_registry.php @@ -182,5 +182,15 @@ class ClassRegistry { return $_this->__map[$key]; } } +/** + * Flushes all objects from the ClassREgistry. + * + * @access public + */ + function flush() { + $_this =& ClassRegistry::getInstance(); + $_this->__objects = array(); + $_this->__map = array(); + } } ?> \ No newline at end of file diff --git a/cake/tests/cases/libs/model/model.test.php b/cake/tests/cases/libs/model/model.test.php index cdb181dc1..6f388e3b9 100644 --- a/cake/tests/cases/libs/model/model.test.php +++ b/cake/tests/cases/libs/model/model.test.php @@ -488,7 +488,6 @@ class ModelTest extends CakeTestCase { ) ); $this->assertEqual($result, $expected); - unset($this->DeviceType); } @@ -2738,6 +2737,10 @@ class ModelTest extends CakeTestCase { $this->assertEqual($afterFindData, $noAfterFindData); } + + function endTest() { + ClassRegistry::flush(); + } } /** * Short description for class.