Skip to content
Browse files

FIX VirtualPageTest memory errors due to Config API quirks

  • Loading branch information...
1 parent 51c8e86 commit f73a5c68f303c23a01343f25d14ab02f498423f4 @chillu chillu committed Mar 27, 2013
Showing with 13 additions and 3 deletions.
  1. +13 −3 tests/model/VirtualPageTest.php
View
16 tests/model/VirtualPageTest.php
@@ -17,15 +17,25 @@ public function setUp() {
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;
}

0 comments on commit f73a5c6

Please sign in to comment.
Something went wrong with that request. Please try again.