Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
EcomDev_PHPUnit
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Open
EcomDev_PHPUnit
Commits
86746367
Commit
86746367
authored
Mar 24, 2015
by
Ivan Chepurnyi
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #184 from AOEmedia/issue/178-fixture_scope
Issue/178 fixture scope
parents
9742b6a1
b18329d7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
34 deletions
+18
-34
app/code/community/EcomDev/PHPUnit/Model/App.php
app/code/community/EcomDev/PHPUnit/Model/App.php
+18
-34
No files found.
app/code/community/EcomDev/PHPUnit/Model/App.php
View file @
86746367
...
...
@@ -59,35 +59,11 @@ class EcomDev_PHPUnit_Model_App extends Mage_Core_Model_App
const
XML_PATH_CONTROLLER_RESPONSE
=
'phpunit/suite/controller/response/class'
;
/**
* Old configuration model to be returned back
* 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
* Test scope data to be returned back after unit tests are finished
*
* @var array
*/
protected
static
$_
oldRegistry
=
null
;
protected
static
$_
testScopeStack
=
array
()
;
/**
* Configuration model class name for unit tests
...
...
@@ -143,10 +119,12 @@ class EcomDev_PHPUnit_Model_App extends Mage_Core_Model_App
public
static
function
applyTestScope
()
{
// Save old environment variables
self
::
$_oldApplication
=
EcomDev_Utils_Reflection
::
getRestrictedPropertyValue
(
'Mage'
,
'_app'
);
self
::
$_oldConfig
=
EcomDev_Utils_Reflection
::
getRestrictedPropertyValue
(
'Mage'
,
'_config'
);
self
::
$_oldEventCollection
=
EcomDev_Utils_Reflection
::
getRestrictedPropertyValue
(
'Mage'
,
'_events'
);
self
::
$_oldRegistry
=
EcomDev_Utils_Reflection
::
getRestrictedPropertyValue
(
'Mage'
,
'_registry'
);
self
::
$_testScopeStack
[]
=
array
(
'app'
=>
EcomDev_Utils_Reflection
::
getRestrictedPropertyValue
(
'Mage'
,
'_app'
),
'config'
=>
EcomDev_Utils_Reflection
::
getRestrictedPropertyValue
(
'Mage'
,
'_config'
),
'events'
=>
EcomDev_Utils_Reflection
::
getRestrictedPropertyValue
(
'Mage'
,
'_events'
),
'registry'
=>
EcomDev_Utils_Reflection
::
getRestrictedPropertyValue
(
'Mage'
,
'_registry'
),
);
// Setting environment variables for unit tests
...
...
@@ -434,11 +412,17 @@ class EcomDev_PHPUnit_Model_App extends Mage_Core_Model_App
*/
public
static
function
discardTestScope
()
{
if
(
empty
(
self
::
$_testScopeStack
))
{
throw
new
RuntimeException
(
'No test scope to discard'
);
}
$previousScope
=
array_pop
(
self
::
$_testScopeStack
);
// Setting environment variables for unit tests
EcomDev_Utils_Reflection
::
setRestrictedPropertyValue
(
'Mage'
,
'_app'
,
self
::
$_oldApplication
);
EcomDev_Utils_Reflection
::
setRestrictedPropertyValue
(
'Mage'
,
'_config'
,
self
::
$_oldConfig
);
EcomDev_Utils_Reflection
::
setRestrictedPropertyValue
(
'Mage'
,
'_events'
,
self
::
$_oldEventCollection
);
EcomDev_Utils_Reflection
::
setRestrictedPropertyValue
(
'Mage'
,
'_registry'
,
self
::
$_oldRegistry
);
EcomDev_Utils_Reflection
::
setRestrictedPropertyValue
(
'Mage'
,
'_app'
,
$previousScope
[
'app'
]
);
EcomDev_Utils_Reflection
::
setRestrictedPropertyValue
(
'Mage'
,
'_config'
,
$previousScope
[
'config'
]
);
EcomDev_Utils_Reflection
::
setRestrictedPropertyValue
(
'Mage'
,
'_events'
,
$previousScope
[
'events'
]
);
EcomDev_Utils_Reflection
::
setRestrictedPropertyValue
(
'Mage'
,
'_registry'
,
$previousScope
[
'registry'
]
);
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment