Skip to content
This repository has been archived by the owner on May 27, 2023. It is now read-only.

Fixture object is cached in Magento registry #178

Open
fbrnc opened this issue Mar 4, 2014 · 0 comments
Open

Fixture object is cached in Magento registry #178

fbrnc opened this issue Mar 4, 2014 · 0 comments

Comments

@fbrnc
Copy link

fbrnc commented Mar 4, 2014

Currently app/code/community/EcomDev/PHPUnit/Test/Listener.php stores the fixture objects in the Magento registry. The fixture object is needed after the test run to clean up records that were created. But using the Magento registry is not a good idea as it might be (and should be) reset between test methods.

We'll be submitting a pull request for this with a suggested solution.

LeeSaferite added a commit to AOEmedia/EcomDev_PHPUnit that referenced this issue Mar 5, 2014
The original code would only store the most recent version of the scop data when calling applyTestScope.
If you called the method twice then you lost the original scope.
Parts of the EcomDev_PHPUnit code are using the registry to store information.
Currently the test scope is only setup at the suite level but if tests in the suite expect a clean registry then there are problems.
This change converts to using a stack to store the scope.
Each time you call applyTestScope the current scope data is added to the stack.
Each time you call discardTestScope the previous scope data is restored.
If you call discardTestScope and there is no stored scope data, a RuntimeException is thrown.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant