Ejemplo n.º 1
0
 /**
  * Sets up this test case
  *
  */
 protected function setUp()
 {
     vfsStream::setup('Test');
     $mockBootstrap = $this->getMock('TYPO3\\CMS\\Core\\Core\\Bootstrap', array(), array(), '', FALSE);
     $mockCache = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Frontend\\PhpFrontend', array('has', 'set', 'getBackend'), array(), '', FALSE);
     $mockCacheBackend = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Backend\\SimpleFileBackend', 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', array('sortAndSavePackageStates'));
     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); ");
     $mockClassLoader = $this->getMock('TYPO3\\CMS\\Core\\Core\\ClassLoader', array(), array(\TYPO3\CMS\Core\Core\Bootstrap::getInstance()->getApplicationContext()));
     $mockClassLoader->expects($this->any())->method('setCacheIdentifier')->will($this->returnSelf());
     $composerNameToPackageKeyMap = array('typo3/flow' => 'TYPO3.Flow');
     $this->packageManager->injectClassLoader($mockClassLoader);
     $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);
 }