本文整理汇总了PHP中TYPO3\CMS\Core\Utility\ExtensionManagementUtility::setPackageManager方法的典型用法代码示例。如果您正苦于以下问题:PHP ExtensionManagementUtility::setPackageManager方法的具体用法?PHP ExtensionManagementUtility::setPackageManager怎么用?PHP ExtensionManagementUtility::setPackageManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Utility\ExtensionManagementUtility
的用法示例。
在下文中一共展示了ExtensionManagementUtility::setPackageManager方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: extensionStaticsAreProcessedIfExplicitlyRequested
/**
* @test
*/
public function extensionStaticsAreProcessedIfExplicitlyRequested()
{
$identifier = $this->getUniqueId('test');
$GLOBALS['TYPO3_LOADED_EXT'] = array($identifier => array('ext_typoscript_setup.txt' => ExtensionManagementUtility::extPath('core', 'Tests/Unit/TypoScript/Fixtures/ext_typoscript_setup.txt'), 'ext_typoscript_constants.txt' => ''));
$mockPackage = $this->getMock(\TYPO3\CMS\Core\Package\Package::class, array('getPackagePath'), array(), '', false);
$mockPackage->expects($this->any())->method('getPackagePath')->will($this->returnValue(''));
$mockPackageManager = $this->getMock(\TYPO3\CMS\Core\Package\PackageManager::class, array('isPackageActive', 'getPackage'));
$mockPackageManager->expects($this->any())->method('isPackageActive')->will($this->returnValue(true));
$mockPackageManager->expects($this->any())->method('getPackage')->will($this->returnValue($mockPackage));
ExtensionManagementUtility::setPackageManager($mockPackageManager);
$this->templateService->setProcessExtensionStatics(true);
$this->templateService->runThroughTemplates(array(), 0);
$this->assertTrue(in_array('test.Core.TypoScript = 1', $this->templateService->config));
ExtensionManagementUtility::setPackageManager(GeneralUtility::makeInstance(\TYPO3\CMS\Core\Package\PackageManager::class));
}
示例2: configureBackendLoginSecurity
/**
* @test
* @dataProvider configureBackendLoginSecurityLocalconfiguration
* @param string $current
* @param string $setting
* @param bool $isPackageActive
* @param bool $hasLocalConfig
*/
public function configureBackendLoginSecurity($current, $setting, $isPackageActive, $hasLocalConfig)
{
/** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
$silentConfigurationUpgradeServiceInstance = $this->getAccessibleMock(SilentConfigurationUpgradeService::class, array('dummy'), array(), '', false);
/** @var $packageManager PackageManager|\PHPUnit_Framework_MockObject_MockObject */
$packageManager = $this->getMock(PackageManager::class, array(), array(), '', false);
$packageManager->expects($this->any())->method('isPackageActive')->will($this->returnValue($isPackageActive));
ExtensionManagementUtility::setPackageManager($packageManager);
$currentLocalConfiguration = array(array('BE/loginSecurityLevel', $current));
$closure = function () {
throw new \RuntimeException('Path does not exist in array', 1341397869);
};
$this->createConfigurationManagerWithMockedMethods(array('getLocalConfigurationValueByPath', 'setLocalConfigurationValueByPath'));
if ($hasLocalConfig) {
$this->configurationManager->expects($this->once())->method('getLocalConfigurationValueByPath')->will($this->returnValueMap($currentLocalConfiguration));
} else {
$this->configurationManager->expects($this->once())->method('getLocalConfigurationValueByPath')->will($this->returnCallback($closure));
}
$this->configurationManager->expects($this->once())->method('setLocalConfigurationValueByPath')->with($this->equalTo('BE/loginSecurityLevel'), $this->equalTo($setting));
$this->setExpectedException(RedirectException::class);
$silentConfigurationUpgradeServiceInstance->_set('configurationManager', $this->configurationManager);
$silentConfigurationUpgradeServiceInstance->_call('configureBackendLoginSecurity');
}
示例3: initializePackageManagement
/**
* Initializes the package system and loads the package configuration and settings
* provided by the packages.
*
* @param string $packageManagerClassName Define an alternative package manager implementation (usually for the installer)
* @return Bootstrap
* @internal This is not a public API method, do not use in own extensions
*/
public function initializePackageManagement($packageManagerClassName)
{
/** @var \TYPO3\CMS\Core\Package\PackageManager $packageManager */
$packageManager = new $packageManagerClassName();
$this->setEarlyInstance(\TYPO3\CMS\Core\Package\PackageManager::class, $packageManager);
ExtensionManagementUtility::setPackageManager($packageManager);
$packageManager->injectCoreCache($this->getEarlyInstance(\TYPO3\CMS\Core\Cache\CacheManager::class)->getCache('cache_core'));
$dependencyResolver = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Package\DependencyResolver::class);
$dependencyResolver->injectDependencyOrderingService(GeneralUtility::makeInstance(\TYPO3\CMS\Core\Service\DependencyOrderingService::class));
$packageManager->injectDependencyResolver($dependencyResolver);
$packageManager->initialize();
GeneralUtility::setSingletonInstance(\TYPO3\CMS\Core\Package\PackageManager::class, $packageManager);
return $this;
}
示例4: unloadExtensionCallsPackageManagerToDeactivatePackage
/**
* @test
*/
public function unloadExtensionCallsPackageManagerToDeactivatePackage()
{
$packageName = $this->getUniqueId('foo');
/** @var PackageManager|\PHPUnit_Framework_MockObject_MockObject $packageManager */
$packageManager = $this->getMock(PackageManager::class, array('isPackageActive', 'deactivatePackage'));
$packageManager->expects($this->any())->method('isPackageActive')->will($this->returnValue(TRUE));
$packageManager->expects($this->once())->method('deactivatePackage')->with($packageName);
ExtensionManagementUtility::setPackageManager($packageManager);
ExtensionManagementUtility::unloadExtension($packageName);
}
示例5: tryToLoadExtLocalconfAndExtTablesOfExtensionsCallsWriteCurrentExtensionToFile
/**
* @test
*/
public function tryToLoadExtLocalconfAndExtTablesOfExtensionsCallsWriteCurrentExtensionToFile()
{
// tryToLoadExtLocalconfAndExtTablesOfExtensions() triggers a call to ExtensionManagementUtility::loadBaseTca
// that works on our UnitTestPackageManager to do things. This package manager needs to be mocked here to
// not trigger unwanted side effects.
$packageManager = $this->getMock(\TYPO3\CMS\Core\Package\PackageManager::class, array(), array(), '', false);
$packageManager->expects($this->any())->method('getActivePackages')->will($this->returnValue(array()));
ExtensionManagementUtility::setPackageManager($packageManager);
$extension = array('demo1' => array('type' => 'L', 'ext_tables.php' => PATH_typo3 . 'sysext/install/Tests/Unit/Controller/Action/Ajax/Fixtures/demo1/ext_tables.php'));
$extensionCompatibilityTesterMock = $this->getAccessibleMock(\TYPO3\CMS\Install\Controller\Action\Ajax\ExtensionCompatibilityTester::class, array('loadExtLocalconfForExtension', 'writeCurrentExtensionToFile', 'loadExtTablesForExtension', 'removeCurrentExtensionFromFile'), array());
$extensionCompatibilityTesterMock->expects($this->atLeastOnce())->method('writeCurrentExtensionToFile')->with('demo1');
$extensionCompatibilityTesterMock->_call('tryToLoadExtLocalconfAndExtTablesOfExtensions', $extension);
}
示例6: unloadExtensionCallsPackageManagerToDeactivatePackage
/**
* @test
*/
public function unloadExtensionCallsPackageManagerToDeactivatePackage()
{
$packageName = $this->getUniqueId('foo');
$packageManager = $this->getMock('TYPO3\\CMS\\Core\\Package\\PackageManager', array('isPackageActive', 'deactivatePackage'));
$packageManager->expects($this->any())->method('isPackageActive')->will($this->returnValue(TRUE));
$packageManager->expects($this->once())->method('deactivatePackage')->with($packageName);
ExtensionManagementUtility::setPackageManager($packageManager);
ExtensionManagementUtility::unloadExtension($packageName);
}
示例7: initializePackageManagement
/**
* Initializes the package system and loads the package configuration and settings
* provided by the packages.
*
* @param string $packageManagerClassName Define an alternative package manager implementation (usually for the installer)
* @return void
*/
public function initializePackageManagement($packageManagerClassName = 'Helhum\\Typo3Console\\Package\\UncachedPackageManager')
{
require __DIR__ . '/../Package/UncachedPackageManager.php';
$packageManager = new \Helhum\Typo3Console\Package\UncachedPackageManager();
$this->setEarlyInstance($this->packageManagerInstanceName, $packageManager);
Utility\ExtensionManagementUtility::setPackageManager($packageManager);
// @deprecated in 6.2, will be removed in 7.0
if (is_callable(array($packageManager, 'injectClassLoader'))) {
$packageManager->injectClassLoader($this->getEarlyInstance('TYPO3\\CMS\\Core\\Core\\ClassLoader'));
}
$dependencyResolver = Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Package\\DependencyResolver');
// required since 7.4
if (is_callable(array($dependencyResolver, 'injectDependencyOrderingService'))) {
$dependencyResolver->injectDependencyOrderingService(Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Service\\DependencyOrderingService'));
}
$packageManager->injectDependencyResolver($dependencyResolver);
$packageManager->initialize($this);
Utility\GeneralUtility::setSingletonInstance('TYPO3\\CMS\\Core\\Package\\PackageManager', $packageManager);
}
示例8: tearDown
public function tearDown()
{
ExtensionManagementUtility::setPackageManager(new PackageManager());
}
示例9: initializePackageManagement
/**
* Initializes the package system and loads the package configuration and settings
* provided by the packages.
*
* @param string $packageManagerClassName Define an alternative package manager implementation (usually for the installer)
* @return Bootstrap
* @internal This is not a public API method, do not use in own extensions
*/
public function initializePackageManagement($packageManagerClassName)
{
/** @var \TYPO3\CMS\Core\Package\PackageManager $packageManager */
$packageManager = new $packageManagerClassName();
$this->setEarlyInstance('TYPO3\\Flow\\Package\\PackageManager', $packageManager);
Utility\ExtensionManagementUtility::setPackageManager($packageManager);
$packageManager->injectClassLoader($this->getEarlyInstance('TYPO3\\CMS\\Core\\Core\\ClassLoader'));
$packageManager->injectCoreCache($this->getEarlyInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager')->getCache('cache_core'));
$packageManager->injectDependencyResolver(Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Package\\DependencyResolver'));
$packageManager->initialize($this);
Utility\GeneralUtility::setSingletonInstance('TYPO3\\CMS\\Core\\Package\\PackageManager', $packageManager);
return $this;
}
示例10: initializePackageManagement
/**
* Initializes the package system and loads the package configuration and settings
* provided by the packages.
*
* @param string $packageManagerClassName Define an alternative package manager implementation (usually for the installer)
* @return void
*/
public function initializePackageManagement($packageManagerClassName = 'Helhum\\Typo3Console\\Package\\UncachedPackageManager')
{
require __DIR__ . '/../Package/UncachedPackageManager.php';
$packageManager = new \Helhum\Typo3Console\Package\UncachedPackageManager();
$this->setEarlyInstance('TYPO3\\Flow\\Package\\PackageManager', $packageManager);
Utility\ExtensionManagementUtility::setPackageManager($packageManager);
$packageManager->injectClassLoader($this->getEarlyInstance('TYPO3\\CMS\\Core\\Core\\ClassLoader'));
$packageManager->injectDependencyResolver(Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Package\\DependencyResolver'));
$packageManager->initialize($this);
Utility\GeneralUtility::setSingletonInstance('TYPO3\\CMS\\Core\\Package\\PackageManager', $packageManager);
}