Commit b937a839 authored by Lee Saferite's avatar Lee Saferite

Change to using an array for old scope data

parent bfa5970e
...@@ -59,35 +59,16 @@ class EcomDev_PHPUnit_Model_App extends Mage_Core_Model_App ...@@ -59,35 +59,16 @@ class EcomDev_PHPUnit_Model_App extends Mage_Core_Model_App
const XML_PATH_CONTROLLER_RESPONSE = 'phpunit/suite/controller/response/class'; const XML_PATH_CONTROLLER_RESPONSE = 'phpunit/suite/controller/response/class';
/** /**
* Old configuration model to be returned back * Old test scope data to be returned back after unit tests are finished
* after unit tests are finished
*
* @var Mage_Core_Model_Config
*/
protected static $_oldConfig = null;
/**
* Old application model to be returned back
* after unit tests are finished
*
* @var Mage_Core_Model_App
*/
protected static $_oldApplication = null;
/**
* Old event collection to be returned back
* after the unit tests are finished
*
* @var Varien_Event_Collection
*/
protected static $_oldEventCollection = null;
/**
* List of singletons in original application
* *
* @var array * @var array
*/ */
protected static $_oldRegistry = null; protected static $_oldTestScope = array(
'app' => null,
'config' => null,
'events' => null,
'registry' => null,
);
/** /**
* Configuration model class name for unit tests * Configuration model class name for unit tests
...@@ -143,10 +124,10 @@ class EcomDev_PHPUnit_Model_App extends Mage_Core_Model_App ...@@ -143,10 +124,10 @@ class EcomDev_PHPUnit_Model_App extends Mage_Core_Model_App
public static function applyTestScope() public static function applyTestScope()
{ {
// Save old environment variables // Save old environment variables
self::$_oldApplication = EcomDev_Utils_Reflection::getRestrictedPropertyValue('Mage', '_app'); self::$_oldTestScope['app'] = EcomDev_Utils_Reflection::getRestrictedPropertyValue('Mage', '_app');
self::$_oldConfig = EcomDev_Utils_Reflection::getRestrictedPropertyValue('Mage', '_config'); self::$_oldTestScope['config'] = EcomDev_Utils_Reflection::getRestrictedPropertyValue('Mage', '_config');
self::$_oldEventCollection = EcomDev_Utils_Reflection::getRestrictedPropertyValue('Mage', '_events'); self::$_oldTestScope['events'] = EcomDev_Utils_Reflection::getRestrictedPropertyValue('Mage', '_events');
self::$_oldRegistry = EcomDev_Utils_Reflection::getRestrictedPropertyValue('Mage', '_registry'); self::$_oldTestScope['registry'] = EcomDev_Utils_Reflection::getRestrictedPropertyValue('Mage', '_registry');
// Setting environment variables for unit tests // Setting environment variables for unit tests
...@@ -435,10 +416,10 @@ class EcomDev_PHPUnit_Model_App extends Mage_Core_Model_App ...@@ -435,10 +416,10 @@ class EcomDev_PHPUnit_Model_App extends Mage_Core_Model_App
public static function discardTestScope() public static function discardTestScope()
{ {
// Setting environment variables for unit tests // Setting environment variables for unit tests
EcomDev_Utils_Reflection::setRestrictedPropertyValue('Mage', '_app', self::$_oldApplication); EcomDev_Utils_Reflection::setRestrictedPropertyValue('Mage', '_app', self::$_oldTestScope['app']);
EcomDev_Utils_Reflection::setRestrictedPropertyValue('Mage', '_config', self::$_oldConfig); EcomDev_Utils_Reflection::setRestrictedPropertyValue('Mage', '_config', self::$_oldTestScope['config']);
EcomDev_Utils_Reflection::setRestrictedPropertyValue('Mage', '_events', self::$_oldEventCollection); EcomDev_Utils_Reflection::setRestrictedPropertyValue('Mage', '_events', self::$_oldTestScope['events']);
EcomDev_Utils_Reflection::setRestrictedPropertyValue('Mage', '_registry', self::$_oldRegistry); EcomDev_Utils_Reflection::setRestrictedPropertyValue('Mage', '_registry', self::$_oldTestScope['registry']);
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment