[BUGFIX] Remove the need of PackageStates.php in tests 21/29021/2
authorHelmut Hummel <helmut.hummel@typo3.org>
Tue, 1 Apr 2014 12:15:32 +0000 (14:15 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 1 Apr 2014 18:58:22 +0000 (20:58 +0200)
Although there is code in the package manager tests
to mock a PackageStates.php file, it does not work
as the path to the file is hardcoded in the initialize
action.

Move the code for setting the path and creating
the package factory to the constructor
and move the mocking of the path before initializing
in the test.

Resolves: #57490
Releases: 6.2
Change-Id: I2ca29016de288017ec73ff36d0dbed1e2be0e67d
Reviewed-on: https://review.typo3.org/29021
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Thomas Maroschik
Reviewed-by: Stefan Neufeind
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/core/Classes/Package/PackageManager.php
typo3/sysext/core/Tests/Unit/Package/PackageManagerTest.php

index 5817360..8d8552b 100644 (file)
@@ -88,6 +88,8 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
                        'sysext'    => PATH_typo3 . 'sysext',
                        'composer'  => PATH_site . 'Packages',
                );
+               $this->packageStatesPathAndFilename = PATH_typo3conf . 'PackageStates.php';
+               $this->packageFactory = new PackageFactory($this);
        }
 
        /**
@@ -119,8 +121,6 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
         */
        public function initialize(\TYPO3\Flow\Core\Bootstrap $bootstrap) {
                $this->bootstrap = $bootstrap;
-               $this->packageStatesPathAndFilename = PATH_typo3conf . 'PackageStates.php';
-               $this->packageFactory = new PackageFactory($this);
 
                $loadedFromCache = FALSE;
                try {
index 106f760..95a6f1a 100644 (file)
@@ -54,9 +54,9 @@ class PackageManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $this->packageManager->injectClassLoader($mockClassLoader);
                $this->packageManager->injectCoreCache($mockCache);
                $this->inject($this->packageManager, 'composerNameToPackageKeyMap', $composerNameToPackageKeyMap);
-               $this->packageManager->initialize($mockBootstrap);
                $this->packageManager->_set('packagesBasePath', 'vfs://Test/Packages/');
                $this->packageManager->_set('packageStatesPathAndFilename', 'vfs://Test/Configuration/PackageStates.php');
+               $this->packageManager->initialize($mockBootstrap);
        }
 
        /**