From 3cf4dd8b6c32d359965f2a7428f478d7facad0c0 Mon Sep 17 00:00:00 2001 From: mark_story Date: Tue, 19 Jul 2011 20:25:30 -0400 Subject: [PATCH] Reversing the order fixtures are truncated in order to remove data in a way that better supports foreign keys. Fixes #1837 --- cake/tests/lib/cake_test_case.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cake/tests/lib/cake_test_case.php b/cake/tests/lib/cake_test_case.php index c70b212df..42931e972 100644 --- a/cake/tests/lib/cake_test_case.php +++ b/cake/tests/lib/cake_test_case.php @@ -488,7 +488,7 @@ class CakeTestCase extends UnitTestCase { $isTestMethod = !in_array(strtolower($method), array('start', 'end')); if (isset($this->_fixtures) && isset($this->db) && $isTestMethod) { - foreach ($this->_fixtures as $fixture) { + foreach (array_reverse($this->_fixtures) as $fixture) { $fixture->truncate($this->db); } $this->__truncated = true; @@ -832,4 +832,4 @@ class CakeTestCase extends UnitTestCase { return $permuted; } } -} \ No newline at end of file +}