/** * Sets up this test case * */ protected function setUp() { vfsStream::setup('Test'); $mockBootstrap = $this->getMock(\TYPO3\CMS\Core\Core\Bootstrap::class, array(), array(), '', FALSE); $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\PhpFrontend::class, array('has', 'set', 'getBackend'), array(), '', FALSE); $mockCacheBackend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend::class, array('has', 'set', 'getBackend'), array(), '', FALSE); $mockCache->expects($this->any())->method('has')->will($this->returnValue(FALSE)); $mockCache->expects($this->any())->method('set')->will($this->returnValue(TRUE)); $mockCache->expects($this->any())->method('getBackend')->will($this->returnValue($mockCacheBackend)); $mockCacheBackend->expects($this->any())->method('getCacheDirectory')->will($this->returnValue('vfs://Test/Cache')); $this->packageManager = $this->getAccessibleMock(\TYPO3\CMS\Core\Package\PackageManager::class, array('sortAndSavePackageStates', 'sortAvailablePackagesByDependencies', 'registerAutoloadInformationInClassLoader')); mkdir('vfs://Test/Packages/Application', 0700, TRUE); mkdir('vfs://Test/Configuration'); file_put_contents('vfs://Test/Configuration/PackageStates.php', "<?php return array ('packages' => array(), 'version' => 4); "); $composerNameToPackageKeyMap = array( 'typo3/flow' => 'TYPO3.Flow' ); $this->packageManager->injectCoreCache($mockCache); $this->inject($this->packageManager, 'composerNameToPackageKeyMap', $composerNameToPackageKeyMap); $this->packageManager->_set('packagesBasePath', 'vfs://Test/Packages/'); $this->packageManager->_set('packageStatesPathAndFilename', 'vfs://Test/Configuration/PackageStates.php'); $this->packageManager->initialize($mockBootstrap); }