本文整理匯總了PHP中Contao\Config::preload方法的典型用法代碼示例。如果您正苦於以下問題:PHP Config::preload方法的具體用法?PHP Config::preload怎麽用?PHP Config::preload使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Contao\Config
的用法示例。
在下文中一共展示了Config::preload方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: bootHelperSystem
/**
* Boots the helper system.
*/
private function bootHelperSystem()
{
$contaoDir = $this->getRootDir() . '/../vendor/contao/core-bundle';
require_once $contaoDir . '/src/Resources/contao/config/constants.php';
require_once $contaoDir . '/src/Resources/contao/helper/functions.php';
// Register the class loader
$libraryLoader = new LibraryLoader($this->getRootDir());
$libraryLoader->register();
Config::preload();
// Create the container
$this->container = ContainerFactory::create($this);
System::setContainer($this->container);
ClassLoader::scanAndRegister();
}
示例2: testNotInitializedTwice
/**
* Tests that the framework is not initialized twice.
*
* @runInSeparateProcess
*/
public function testNotInitializedTwice()
{
$request = new Request();
$request->attributes->set('_contao_referer_id', 'foobar');
$container = $this->mockContainerWithContaoScopes(ContaoCoreBundle::SCOPE_BACKEND);
$container->get('request_stack')->push($request);
$container->setParameter('contao.csrf_token_name', 'dummy_token');
$container->set('security.csrf.token_manager', new CsrfTokenManager());
// Ensure to use the fixtures class
Config::preload();
/** @var ContaoFramework|\PHPUnit_Framework_MockObject_MockObject $framework */
$framework = $this->getMockBuilder('Contao\\CoreBundle\\Framework\\ContaoFramework')->setConstructorArgs([$container->get('request_stack'), $this->mockRouter('/contao/install'), $this->mockSession(), $this->getRootDir() . '/app', error_reporting()])->setMethods(['isInitialized'])->getMock();
$framework->expects($this->any())->method('isInitialized')->willReturnOnConsecutiveCalls(false, true);
$framework->expects($this->any())->method('getAdapter')->with($this->equalTo('Contao\\Config'))->willReturn($this->mockConfigAdapter());
$framework->setContainer($container);
$framework->initialize();
$framework->initialize();
}
示例3: AppKernel
<?php
/**
* This file is part of Contao.
*
* Copyright (c) 2005-2015 Leo Feyer
*
* @license LGPL-3.0+
*/
use Contao\Config;
use Contao\InstallationBundle\ClassLoader\LibraryLoader;
use Contao\InstallationBundle\Controller\InstallationController;
use Contao\InstallationBundle\DependencyInjection\ContainerFactory;
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_USER_DEPRECATED);
$loader = (require_once __DIR__ . '/../vendor/autoload.php');
require_once __DIR__ . '/../app/AppKernel.php';
require_once __DIR__ . '/../vendor/contao/core-bundle/src/Resources/contao/helper/functions.php';
$kernel = new AppKernel('prod', false);
// Register the class loader
$libraryLoader = new LibraryLoader($kernel->getRootDir());
$libraryLoader->register();
Config::preload();
// Create the container
$container = ContainerFactory::create($kernel->getRootDir());
// Run the controller
$controller = new InstallationController();
$controller->setContainer($container);
$response = $controller->indexAction();
$response->send();
示例4: mockContaoFramework
/**
* Returns a ContaoFramework instance.
*
* @param RequestStack $requestStack The request stack
* @param RouterInterface $router The router object
* @param CsrfTokenManagerInterface|null $tokenManager An optional token manager
* @param ConfigAdapter|null $configAdatper An optional config adapter
*
* @return ContaoFramework The object instance
*/
public function mockContaoFramework(RequestStack $requestStack = null, RouterInterface $router = null, CsrfTokenManagerInterface $tokenManager = null, ConfigAdapter $configAdatper = null)
{
// Ensure to use the fixtures class
Config::preload();
$container = $this->mockContainerWithContaoScopes();
if (null === $requestStack) {
$requestStack = $container->get('request_stack');
}
if (null === $router) {
$router = $this->mockRouter('/index.html');
}
if (null === $tokenManager) {
$tokenManager = new CsrfTokenManager($this->getMock('Symfony\\Component\\Security\\Csrf\\TokenGenerator\\TokenGeneratorInterface'), $this->getMock('Symfony\\Component\\Security\\Csrf\\TokenStorage\\TokenStorageInterface'));
}
if (null === $configAdatper) {
$configAdatper = $this->mockConfig();
}
$framework = new ContaoFramework($requestStack, $router, $this->mockSession(), $this->getRootDir() . '/app', $tokenManager, 'contao_csrf_token', $configAdatper, error_reporting());
$framework->setContainer($container);
return $framework;
}
示例5: preload
/**
* Preloads the default and local configuration.
*/
public function preload()
{
Config::preload();
}
示例6: testNotInitializedTwice
/**
* Tests that the framework is not initialized twice.
*
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testNotInitializedTwice()
{
$request = new Request();
$request->attributes->set('_contao_referer_id', 'foobar');
$container = $this->mockContainerWithContaoScopes();
$container->enterScope(ContaoCoreBundle::SCOPE_BACKEND);
$container->get('request_stack')->push($request);
// Ensure to use the fixtures class
Config::preload();
/** @var ContaoFramework|\PHPUnit_Framework_MockObject_MockObject $framework */
$framework = $this->getMockBuilder('Contao\\CoreBundle\\ContaoFramework')->setConstructorArgs([$container->get('request_stack'), $this->mockRouter('/contao/install'), $this->mockSession(), $this->getRootDir() . '/app', new CsrfTokenManager($this->getMock('Symfony\\Component\\Security\\Csrf\\TokenGenerator\\TokenGeneratorInterface'), $this->getMock('Symfony\\Component\\Security\\Csrf\\TokenStorage\\TokenStorageInterface')), 'contao_csrf_token', $this->mockConfig(), error_reporting()])->setMethods(['isInitialized'])->getMock();
$framework->expects($this->any())->method('isInitialized')->willReturnOnConsecutiveCalls(false, true);
$framework->setContainer($container);
$framework->initialize();
$framework->initialize();
}