當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Application::boot方法代碼示例

本文整理匯總了PHP中Silex\Application::boot方法的典型用法代碼示例。如果您正苦於以下問題:PHP Application::boot方法的具體用法?PHP Application::boot怎麽用?PHP Application::boot使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Silex\Application的用法示例。


在下文中一共展示了Application::boot方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testBootWithTwig

 public function testBootWithTwig()
 {
     $this->app->register($this->provider);
     $this->app->register(new TwigServiceProvider());
     $this->app->boot();
     $this->assertInstanceOf('CalendR\\Extension\\Twig\\CalendRExtension', $this->app['twig']->getExtension('calendr'));
 }
開發者ID:morloderex,項目名稱:CalendR,代碼行數:7,代碼來源:CalendRServiceProviderTest.php

示例2: testWithLoader

 public function testWithLoader()
 {
     $this->app['env.loader'] = $this->app->protect(function () {
         return $_SERVER;
     });
     $this->app->register(new EnvironmentProvider());
     $this->app->boot();
     $this->assertEquals($_SERVER, $this->app['env']->getVars());
 }
開發者ID:stikmanw,項目名稱:rest-event-framework,代碼行數:9,代碼來源:EnvironmentServiceProviderTest.php

示例3: boot

 /**
  * @return Application
  */
 public function boot()
 {
     if ($this->parameters->isAppClassFilled()) {
         $class = $this->parameters->getAppClass();
         $this->application = new $class(['debug' => $this->parameters->isDebugEnabled(), 'env' => $this->parameters->getEnv()]);
         $this->application->boot();
         return $this->application;
     }
     $this->application = (require $this->parameters->getApp());
     $this->application['debug'] = $this->parameters->isDebugEnabled();
     $this->application['env'] = $this->parameters->getEnv();
     $this->application['session.test'] = $this->parameters->isTestSessionEnabled();
     $this->application->boot();
     return $this->application;
 }
開發者ID:tabbi89,項目名稱:Behat-Silex-Extension,代碼行數:18,代碼來源:ApplicationManager.php

示例4: testRegisteredServices

 /**
  * Ensures the service provider registers the correct services.
  */
 public function testRegisteredServices()
 {
     $firewall = 'http-auth';
     $authenticationListenerServices = ['security.authentication_provider.' . $firewall . '.hmac', 'security.authentication_listener.' . $firewall . '.hmac', 'security.entry_point.' . $firewall . '.hmac', 'pre_auth'];
     $keyLoader = $this->getMock(KeyLoaderInterface::class);
     $app = new Application();
     $app->register(new SecurityServiceProvider());
     $app->register(new HmacSecurityProvider($keyLoader));
     $app['security.firewalls'] = [$firewall => ['pattern' => '^.*$', 'hmac' => true]];
     $app->boot();
     $this->assertArrayHasKey('security.authentication_listener.factory.hmac', $app);
     $this->assertArrayHasKey('security.hmac.response_listener', $app);
     $this->assertArrayHasKey('security.authentication_provider.hmac._proto', $app);
     $this->assertArrayHasKey('security.authentication_listener.hmac._proto', $app);
     $this->assertArrayHasKey('security.entry_point.hmac._proto', $app);
     $this->assertInstanceOf(HmacResponseListener::class, $app['security.hmac.response_listener']);
     $factoryResponse = $app['security.authentication_listener.factory.hmac']($firewall, []);
     $this->assertEquals($authenticationListenerServices, $factoryResponse);
     $this->assertArrayHasKey('security.authentication_provider.' . $firewall . '.hmac', $app);
     $this->assertInstanceOf(HmacAuthenticationProvider::class, $app['security.authentication_provider.' . $firewall . '.hmac']);
     $this->assertArrayHasKey('security.authentication_listener.' . $firewall . '.hmac', $app);
     $this->assertInstanceOf(HmacAuthenticationListener::class, $app['security.authentication_listener.' . $firewall . '.hmac']);
     $this->assertArrayHasKey('security.entry_point.' . $firewall . '.hmac', $app);
     $this->assertInstanceOf(HmacAuthenticationEntryPoint::class, $app['security.entry_point.' . $firewall . '.hmac']);
 }
開發者ID:acquia,項目名稱:http-hmac-php,代碼行數:28,代碼來源:HmacSecurityProviderTest.php

示例5: testSettingOfDependencyInjectionControllerResolver

 /**
  * @covers Fudge\SilexComponents\DependencyInjection\DependencyInjectionServiceProvider::register
  * @covers Fudge\SilexComponents\DependencyInjection\DependencyInjectionServiceProvider::boot
  */
 public function testSettingOfDependencyInjectionControllerResolver()
 {
     $app = new Application();
     $app->register(new DependencyInjectionServiceProvider());
     $app->boot();
     $this->assertInstanceOf(__NAMESPACE__ . "\\ControllerResolver", $app['resolver']);
 }
開發者ID:BennyC,項目名稱:silex-dependency-injection,代碼行數:11,代碼來源:DependencyInjectionServiceProviderTest.php

示例6: testGaufretteCache

 public function testGaufretteCache()
 {
     $app = new Application();
     $app->register(new GaufretteServiceProvider(), array('gaufrette.adapter.class' => 'InMemory', 'gaufrette.adapter.cache.class' => 'Local', 'gaufrette.cache.options' => array(__DIR__ . '/cache')));
     $app->boot();
     $this->assertInstanceOf('\\Gaufrette\\Adapter\\Cache', $app['gaufrette.cache']);
 }
開發者ID:ilosada,項目名稱:chamilo-lms-icpna,代碼行數:7,代碼來源:GaufretteServiceProviderTest.php

示例7: getApplication

 /**
  * Returns an initialized Silex application with a registered instance
  * of PBKDF2ServiceProvider.
  *
  * @param Array $providerConfiguration Parameters for the provider configuration.
  * @return Application
  */
 protected function getApplication(array $providerConfiguration = array())
 {
     $app = new Application();
     $app->register(new PBKDF2(), $providerConfiguration);
     $app->boot();
     return $app;
 }
開發者ID:nrk,項目名稱:PBKDF2ServiceProvider,代碼行數:14,代碼來源:PBKDF2ServiceProvider.php

示例8: testItAddsRequestTrustedProxiesSubscriberOnBoot

 public function testItAddsRequestTrustedProxiesSubscriberOnBoot()
 {
     $app = new Application();
     $app['root.path'] = __DIR__ . '/../../../../../..';
     $app->register(new ConfigurationServiceProvider());
     $app['phraseanet.configuration.config-path'] = __DIR__ . '/fixtures/config-proxies.yml';
     $app['phraseanet.configuration.config-compiled-path'] = __DIR__ . '/fixtures/config-proxies.php';
     $app->boot();
     /** @var EventDispatcherInterface $dispatcher */
     $dispatcher = $app['dispatcher'];
     $listener = null;
     $method = null;
     foreach ($dispatcher->getListeners(KernelEvents::REQUEST) as $callable) {
         // Only look for TrustedProxySubscriber instances
         if (!is_array($callable)) {
             continue;
         }
         list($listener, $method) = $callable;
         if ($listener instanceof TrustedProxySubscriber) {
             break;
         }
     }
     $this->assertInstanceOf('Alchemy\\Phrasea\\Core\\Event\\Subscriber\\TrustedProxySubscriber', $listener, 'TrustedProxySubscriber was not properly registered');
     $this->assertEquals('setProxyConf', $method);
     $this->assertSame([], Request::getTrustedProxies());
     $listener->setProxyConf();
     $this->assertSame(['127.0.0.1', '66.6.66.6'], Request::getTrustedProxies());
     unlink($app['phraseanet.configuration.config-compiled-path']);
 }
開發者ID:luisbrito,項目名稱:Phraseanet,代碼行數:29,代碼來源:ConfigurationServiceProviderTest.php

示例9: __construct

 public function __construct(SilexApplication $application, $projectDirectory, $name = 'UNKNOWN', $version = 'UNKNOWN')
 {
     parent::__construct($name, $version);
     $this->silexApplication = $application;
     $this->projectDirectory = $projectDirectory;
     $application->boot();
 }
開發者ID:ygeneration666,項目名稱:ec,代碼行數:7,代碼來源:Application.php

示例10: testRegisterServiceProvidersWithRegisterWithValidValueAndParametersWithTypeError

 /**
  * @expectedException \InvalidArgumentException
  */
 public function testRegisterServiceProvidersWithRegisterWithValidValueAndParametersWithTypeError()
 {
     $app = new Application();
     $app['cekurte.manager.providers'] = ['Silex\\Provider\\HttpFragmentServiceProvider' => ['register' => true, 'type' => 'invalid-value']];
     $app->register(new ManagerServiceProvider());
     $app->boot();
 }
開發者ID:jpcercal,項目名稱:silex-manager-provider,代碼行數:10,代碼來源:ManagerServiceProviderTest.php

示例11: boot

 public function boot()
 {
     $booted = $this->booted;
     if (!$booted) {
         foreach ($this->providers as $provider) {
             // handle pack's options
             $this->registerOptionnablePack($provider);
             // handle pack's commands
             // must be done before the orm provider register()
             $this->registerConsolablePack($provider);
             // handle pack's assets for assetic
             $this->registerAssetablePack($provider);
         }
         // find pack's translations
         $this->registerTranslatablePacks();
         // handle pack's entities
         // must be done before the console boot()
         $this->registerEntitablePacks();
     }
     parent::boot();
     if (!$booted) {
         foreach ($this->providers as $provider) {
             // handle twig pack
             $this->registerTwiggablePack($provider);
             // add namespace to assetic
             $this->postBootRegisterAssetablePack($provider);
             // connect pack
             $this->registerMountablePack($provider);
         }
         // handle twig template override
         $this->addPackOverridingTemplatePathToTwig();
     }
 }
開發者ID:quazardous,項目名稱:silex-pack,代碼行數:33,代碼來源:PackableApplication.php

示例12: createApplication

 public function createApplication()
 {
     $app = new Application(['env' => 'test']);
     require __DIR__ . '/../app/AppKernel.php';
     $app->boot();
     return $app;
 }
開發者ID:miguelbemartin,項目名稱:oauth2-php,代碼行數:7,代碼來源:WebTestCase.php

示例13: boot

 /**
  * Load configuration and boot the applications
  *
  * {@inheritdoc}
  */
 public function boot()
 {
     $this->initializeConfig();
     foreach ($this->apps as $app) {
         $app->boot($this);
     }
     parent::boot();
 }
開發者ID:sergiors,項目名稱:lullaby,代碼行數:13,代碼來源:Kernel.php

示例14: testCoverBoot

 public function testCoverBoot()
 {
     $app = new Application();
     $app['monolog.logfile'] = false;
     $app->register(new MonologServiceProvider());
     $app->register(new ExtendedLoggerServiceProvider());
     $app->boot();
 }
開發者ID:aptoma,項目名稱:silex-extras,代碼行數:8,代碼來源:ExtendedLoggerServiceProviderTest.php

示例15: testConfiguredApplicationWithTwigExtensionDisabled

 public function testConfiguredApplicationWithTwigExtensionDisabled()
 {
     $app = new Application();
     $app->register(new TwigServiceProvider());
     $app->register(new PuliServiceProvider(), array('puli.enable_twig' => false));
     $app->boot();
     $this->assertFalse($app['twig']->hasExtension('puli'));
     $this->assertNotInstanceOf('Puli\\TwigExtension\\PuliTemplateLoader', $app['twig.loader']);
 }
開發者ID:tgalopin,項目名稱:silex-provider,代碼行數:9,代碼來源:PuliServiceProviderTest.php


注:本文中的Silex\Application::boot方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。