From f73a5c68f303c23a01343f25d14ab02f498423f4 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 27 Mar 2013 10:50:31 +0100 Subject: [PATCH] FIX VirtualPageTest memory errors due to Config API quirks --- tests/model/VirtualPageTest.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/model/VirtualPageTest.php b/tests/model/VirtualPageTest.php index 695d81cb..ac4e9279 100644 --- a/tests/model/VirtualPageTest.php +++ b/tests/model/VirtualPageTest.php @@ -17,15 +17,25 @@ class VirtualPageTest extends SapphireTest { parent::setUp(); $this->origInitiallyCopiedFields = VirtualPage::config()->initially_copied_fields; - VirtualPage::config()->initially_copied_fields = array('MyInitiallyCopiedField'); + Config::inst()->remove('VirtualPage', 'initially_copied_fields'); + VirtualPage::config()->initially_copied_fields = array_merge( + $this->origInitiallyCopiedFields, + array('MyInitiallyCopiedField') + ); + $this->origNonVirtualField = VirtualPage::config()->non_virtual_fields; - $nonVirtual = VirtualPage::config()->non_virtual_fields; - VirtualPage::config()->non_virtual_fields = array('MyNonVirtualField', 'MySharedNonVirtualField'); + Config::inst()->remove('VirtualPage', 'non_virtual_fields'); + VirtualPage::config()->non_virtual_fields = array_merge( + $this->origNonVirtualField, + array('MyNonVirtualField', 'MySharedNonVirtualField') + ); } public function tearDown() { parent::tearDown(); + Config::inst()->remove('VirtualPage', 'initially_copied_fields'); + Config::inst()->remove('VirtualPage', 'non_virtual_fields'); VirtualPage::config()->initially_copied_fields = $this->origInitiallyCopiedFields; VirtualPage::config()->non_virtual_fields = $this->origNonVirtualField; }