preload() 공개 정적인 메소드

Preload the default and local configuration
public static preload ( )
예제 #1
0
 /**
  * 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
0
 /**
  * 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
0
파일: install.php 프로젝트: swissviet/heb-4
<?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
0
 /**
  * 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
0
 /**
  * Preloads the default and local configuration.
  */
 public function preload()
 {
     Config::preload();
 }
 /**
  * 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();
 }