From f73a5c68f303c23a01343f25d14ab02f498423f4 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 27 Mar 2013 10:50:31 +0100 Subject: [PATCH 1/2] 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; } From 18201c05afb1617afe024b6c63eb16ff384f278d Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 27 Mar 2013 12:00:55 +0100 Subject: [PATCH 2/2] Fixed Config usage in ErrorPage --- code/model/ErrorPage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/model/ErrorPage.php b/code/model/ErrorPage.php index e5603b21..f24fa76d 100644 --- a/code/model/ErrorPage.php +++ b/code/model/ErrorPage.php @@ -70,7 +70,7 @@ class ErrorPage extends Page { public function requireDefaultRecords() { parent::requireDefaultRecords(); - if ($this->class == 'ErrorPage' && SiteTree::get_create_default_pages()) { + if ($this->class == 'ErrorPage' && SiteTree::config()->create_default_pages) { // Ensure that an assets path exists before we do any error page creation if(!file_exists(ASSETS_PATH)) { mkdir(ASSETS_PATH);