本文整理汇总了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'));
}
示例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());
}
示例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;
}
示例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']);
}
示例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']);
}
示例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;
}
示例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']);
}
示例9: __construct
public function __construct(SilexApplication $application, $projectDirectory, $name = 'UNKNOWN', $version = 'UNKNOWN')
{
parent::__construct($name, $version);
$this->silexApplication = $application;
$this->projectDirectory = $projectDirectory;
$application->boot();
}
示例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();
}
示例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();
}
}
示例12: createApplication
public function createApplication()
{
$app = new Application(['env' => 'test']);
require __DIR__ . '/../app/AppKernel.php';
$app->boot();
return $app;
}
示例13: boot
/**
* Load configuration and boot the applications
*
* {@inheritdoc}
*/
public function boot()
{
$this->initializeConfig();
foreach ($this->apps as $app) {
$app->boot($this);
}
parent::boot();
}
示例14: testCoverBoot
public function testCoverBoot()
{
$app = new Application();
$app['monolog.logfile'] = false;
$app->register(new MonologServiceProvider());
$app->register(new ExtendedLoggerServiceProvider());
$app->boot();
}
示例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']);
}