[BUGFIX] Incomplete mock reset in StandaloneViewTest
authorChristian Kuhn <lolli@schwarzbu.ch>
Tue, 26 Mar 2013 19:09:14 +0000 (20:09 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 26 Mar 2013 19:15:20 +0000 (20:15 +0100)
setUp() fills the makeInstance LIFO via addInstance() with dummy
instances. Some of them are used in the tests and fetched from
this stack during the tests, but not all, which leaves some
instances after this test case is finished.
Other tests can stumble upon that and are feeded with
mocks unexpectedly.
The patch resets the stack in a clean way in tearDown() and
reconstitutes saved singleton object instances afterwards.

Change-Id: I7bea19ec22aec28b1098b7ae40ff4657be34af7f
Fixes: #46695
Related: #38163
Releases: 6.1, 6.0
Reviewed-on: https://review.typo3.org/19310
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/fluid/Tests/Unit/View/StandaloneViewTest.php

index 147bcfb..172ac07 100644 (file)
@@ -132,6 +132,7 @@ class StandaloneViewTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @return void
         */
        public function tearDown() {
         * @return void
         */
        public function tearDown() {
+               \TYPO3\CMS\Core\Utility\GeneralUtility::purgeInstances();
                \TYPO3\CMS\Core\Utility\GeneralUtility::resetSingletonInstances($this->singletonInstances);
        }
 
                \TYPO3\CMS\Core\Utility\GeneralUtility::resetSingletonInstances($this->singletonInstances);
        }