本文整理汇总了PHP中TYPO3\Flow\Configuration\ConfigurationManager::injectConfigurationSource方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigurationManager::injectConfigurationSource方法的具体用法?PHP ConfigurationManager::injectConfigurationSource怎么用?PHP ConfigurationManager::injectConfigurationSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\Flow\Configuration\ConfigurationManager
的用法示例。
在下文中一共展示了ConfigurationManager::injectConfigurationSource方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
$package1 = $this->getMock('TYPO3\\Flow\\Package\\PackageInterface');
$package1->expects($this->any())->method('getPackageKey')->will($this->returnValue('Foo.Package1'));
$package1->expects($this->any())->method('getConfigurationPath')->will($this->returnValue(__DIR__ . '/../Fixture/Roles/Foo.Package1/'));
$package2 = $this->getMock('TYPO3\\Flow\\Package\\PackageInterface');
$package2->expects($this->any())->method('getPackageKey')->will($this->returnValue('Package2'));
$package2->expects($this->any())->method('getConfigurationPath')->will($this->returnValue(__DIR__ . '/../Fixture/Roles/Package2/'));
$this->configurationManager = new \TYPO3\Flow\Configuration\ConfigurationManager(new \TYPO3\Flow\Core\ApplicationContext('Testing'));
$this->configurationManager->setPackages(array($package1->getPackageKey() => $package1, $package2->getPackageKey() => $package2));
$this->configurationManager->injectConfigurationSource(new \TYPO3\Flow\Configuration\Source\YamlSource());
$mockEnvironment = $this->getMock('TYPO3\\Flow\\Utility\\Environment', array(), array(), '', FALSE);
$this->configurationManager->injectEnvironment($mockEnvironment);
$this->policyService = $this->getAccessibleMock('TYPO3\\Flow\\Security\\Policy\\PolicyService', array('setAclsForEverybodyRole'), array(), '', FALSE);
$this->policyService->injectConfigurationManager($this->configurationManager);
$this->policyService->_set('policy', $this->configurationManager->getConfiguration(\TYPO3\Flow\Configuration\ConfigurationManager::CONFIGURATION_TYPE_POLICY));
}
示例2: initializeConfiguration
/**
* Initializes the Configuration Manager, the Flow settings and the Environment service
*
* @param Bootstrap $bootstrap
* @return void
* @throws \TYPO3\Flow\Exception
*/
public static function initializeConfiguration(Bootstrap $bootstrap)
{
$context = $bootstrap->getContext();
$packageManager = $bootstrap->getEarlyInstance(PackageManagerInterface::class);
$configurationManager = new ConfigurationManager($context);
$configurationManager->injectConfigurationSource(new YamlSource());
$configurationManager->loadConfigurationCache();
$configurationManager->setPackages($packageManager->getActivePackages());
$settings = $configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'TYPO3.Flow');
$environment = new Environment($context);
if (isset($settings['utility']['environment']['temporaryDirectoryBase'])) {
$defaultTemporaryDirectoryBase = FLOW_PATH_DATA . '/Temporary';
if (FLOW_PATH_TEMPORARY_BASE !== $defaultTemporaryDirectoryBase) {
throw new \TYPO3\Flow\Exception(sprintf('It seems like the PHP default temporary base path has been changed from "%s" to "%s" via the FLOW_PATH_TEMPORARY_BASE environment variable. If that variable is present, the TYPO3.Flow.utility.environment.temporaryDirectoryBase setting must not be specified!', $defaultTemporaryDirectoryBase, FLOW_PATH_TEMPORARY_BASE), 1447707261);
}
$environment->setTemporaryDirectoryBase($settings['utility']['environment']['temporaryDirectoryBase']);
} else {
$environment->setTemporaryDirectoryBase(FLOW_PATH_TEMPORARY_BASE);
}
$configurationManager->setTemporaryDirectoryPath($environment->getPathToTemporaryDirectory());
$lockManager = new LockManager($settings['utility']['lockStrategyClassName'], ['lockDirectory' => Files::concatenatePaths([$environment->getPathToTemporaryDirectory(), 'Lock'])]);
Lock::setLockManager($lockManager);
$packageManager->injectSettings($settings);
$bootstrap->getSignalSlotDispatcher()->dispatch(ConfigurationManager::class, 'configurationManagerReady', array($configurationManager));
$bootstrap->setEarlyInstance(ConfigurationManager::class, $configurationManager);
$bootstrap->setEarlyInstance(Environment::class, $environment);
}