/** * @test */ public function getPathToTemporaryDirectoryReturnsAnExistingPath() { $environment = new \TYPO3\FLOW3\Utility\Environment(new ApplicationContext('Testing')); $environment->setTemporaryDirectoryBase(\TYPO3\FLOW3\Utility\Files::concatenatePaths(array(sys_get_temp_dir(), 'FLOW3EnvironmentTest'))); $path = $environment->getPathToTemporaryDirectory(); $this->assertTrue(file_exists($path), 'The temporary path does not exist.'); }
/** * Initializes the Configuration Manager, the FLOW3 settings and the Environment service * * @param \TYPO3\FLOW3\Core\Bootstrap $bootstrap * @return void */ public static function initializeConfiguration(Bootstrap $bootstrap) { $context = $bootstrap->getContext(); $packageManager = $bootstrap->getEarlyInstance('TYPO3\\FLOW3\\Package\\PackageManagerInterface'); $configurationManager = new \TYPO3\FLOW3\Configuration\ConfigurationManager($context); $configurationManager->injectConfigurationSource(new \TYPO3\FLOW3\Configuration\Source\YamlSource()); $configurationManager->loadConfigurationCache(); $configurationManager->setPackages($packageManager->getActivePackages()); $settings = $configurationManager->getConfiguration(\TYPO3\FLOW3\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'TYPO3.FLOW3'); $environment = new \TYPO3\FLOW3\Utility\Environment($context); $environment->setTemporaryDirectoryBase($settings['utility']['environment']['temporaryDirectoryBase']); $configurationManager->injectEnvironment($environment); $packageManager->injectSettings($settings); $bootstrap->setEarlyInstance('TYPO3\\FLOW3\\Configuration\\ConfigurationManager', $configurationManager); $bootstrap->setEarlyInstance('TYPO3\\FLOW3\\Utility\\Environment', $environment); }