本文整理汇总了PHP中Illuminate\Foundation\Application::boot方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::boot方法的具体用法?PHP Application::boot怎么用?PHP Application::boot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Foundation\Application
的用法示例。
在下文中一共展示了Application::boot方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: refreshApplication
/**
* Refresh the application instance.
*
* @return void
*/
protected function refreshApplication()
{
$this->app = $this->createApplication();
$this->client = $this->createClient();
$this->app->setRequestForConsoleEnvironment();
$this->app->boot();
}
示例2: initialize
/**
* Initialize the Laravel Framework.
*
* @throws ModuleConfig
*/
private function initialize()
{
// Store a reference to the database object
// so the database connection can be reused during tests
$oldDb = null;
if ($this->app['db'] && $this->app['db']->connection()) {
$oldDb = $this->app['db'];
}
// Store the current value for the router filters
// so it can be reset after reloading the application
$oldFiltersEnabled = null;
if ($router = $this->app['router']) {
$property = new \ReflectionProperty(get_class($router), 'filtering');
$property->setAccessible(true);
$oldFiltersEnabled = $property->getValue($router);
}
$this->app = $this->loadApplication();
$this->kernel = $this->getStackedClient();
$this->app->boot();
// Reset the booted flag of the Application object
// so the app will be booted again if it receives a new Request
$property = new \ReflectionProperty(get_class($this->app), 'booted');
$property->setAccessible(true);
$property->setValue($this->app, false);
if ($oldDb) {
$this->app['db'] = $oldDb;
Model::setConnectionResolver($this->app['db']);
}
if (!is_null($oldFiltersEnabled)) {
$oldFiltersEnabled ? $this->app['router']->enableFilters() : $this->app['router']->disableFilters();
}
$this->module->setApplication($this->app);
}
示例3: __construct
/**
* Constructor.
*
* @param Application $app
*/
public function __construct(Application $app)
{
$this->app = $app;
$this->httpKernel = $this->app->make('Illuminate\\Contracts\\Http\\Kernel');
$this->httpKernel->bootstrap();
$this->app->boot();
parent::__construct($this);
}
示例4: createApplication
/**
* Create an barebones Laravel application.
*/
protected function createApplication()
{
$this->app = new Application(__DIR__ . '/../../..');
$this->app->instance('config', new Repository([]));
$this->app['config']->set('session.driver', 'array');
$this->app['config']->set('database', ['fetch' => PDO::FETCH_CLASS, 'default' => 'sqlite', 'connections' => ['sqlite' => ['driver' => 'sqlite', 'database' => ':memory:', 'prefix' => '']], 'migrations' => 'migrations']);
$this->app['config']->set('app', ['providers' => [FilesystemServiceProvider::class, FoundationServiceProvider::class, PipelineServiceProvider::class, SessionServiceProvider::class, ViewServiceProvider::class, DatabaseServiceProvider::class, MigrationServiceProvider::class]]);
$this->app->registerConfiguredProviders();
$this->app->boot();
}
示例5: _before
public function _before(\Codeception\TestCase $test)
{
$this->kernel = $this->getApplication();
$this->kernel->boot();
$this->kernel->setRequestForConsoleEnvironment();
$this->client = new LaravelConnector($this->kernel);
$this->client->followRedirects(true);
if ($this->config['filters']) {
$this->haveEnabledFilters();
}
if ($this->transactionCleanup()) {
$this->kernel['db']->beginTransaction();
}
}
示例6: __construct
/**
* Constructor.
*
* @param Application $app
*/
public function __construct(Application $app)
{
$this->app = $app;
$this->httpKernel = $this->app->make('Illuminate\\Contracts\\Http\\Kernel');
$this->httpKernel->bootstrap();
$this->app->boot();
$url = $this->app->config->get('app.url', 'http://localhost');
$this->app->instance('request', Request::createFromBase(SyfmonyRequest::create($url)));
$components = parse_url($url);
$host = isset($components['host']) ? $components['host'] : 'localhost';
parent::__construct($this, ['HTTP_HOST' => $host]);
$this->followRedirects(true);
// Parent constructor sets this to false by default
}
示例7: make
/**
* Create a new Console application.
*
* @param \Illuminate\Foundation\Application $app
* @return \Illuminate\Console\Application
*/
public static function make($app)
{
$app->boot();
$console = with($console = new static('Laravel Framework', $app::VERSION))->setLaravel($app)->setExceptionHandler($app['exception'])->setAutoExit(false);
$app->instance('artisan', $console);
return $console;
}
示例8: boot
public function boot()
{
$this->registerIlluminateProviders();
$this->registerCollejoProviders();
$this->registerAliases();
parent::boot();
}
示例9: refreshApplication
/**
* Refresh the application instance.
*
* @param \Illuminate\Foundation\Application $app Optionally provide your own unbooted
* Laravel Application instance. This
* parameter can largely be ignored and
* is used just for unit testing
* @return void
*/
public function refreshApplication($app = null)
{
$this->app = $app instanceof Application ? $app : $this->createApplication();
$this->app->setRequestForConsoleEnvironment();
$this->app->boot();
if ($this->migrateDatabase) {
$artisan = $this->app->make('artisan');
try {
$artisan->call('migrate:install');
} catch (QueryException $e) {
// migration table is already installed
}
$artisan->call('migrate:refresh');
if ($this->seedDatabase) {
$artisan->call('db:seed', array('--class' => $this->seedClass));
}
}
}
示例10: refreshApplication
/**
* Refresh the application instance.
*
* @return void
*/
protected function refreshApplication()
{
$this->app = $this->createApplication();
Facade::setFacadeApplication($this->app);
$this->app['env'] = 'testing';
$this->app['path.storage'] = __DIR__;
$loader = $this->getMockBuilder('Illuminate\\Config\\LoaderInterface')->setMethods(array('load', 'exists', 'getNamespaces', 'cascadePackage'))->getMockForAbstractClass();
$loader->method('load')->will($this->returnValue(array()));
$loader->method('exists')->will($this->returnValue(true));
$loader->method('getNamespaces')->will($this->returnValue(array()));
$loader->method('cascadePackage')->will($this->returnValue(array()));
$this->app['config'] = new Repository($loader, $this->app['env']);
$this->app['cache'] = new CacheManager($this->app);
$this->app['config']['cache.driver'] = 'array';
$this->app['session'] = new SessionManager($this->app);
$this->app['config']['session.driver'] = 'array';
$this->app['session.store'] = $this->app['session']->driver();
$this->app->boot();
}
示例11: boot
/**
* Boot the application's service providers.
*
* @return void
* @static
*/
public static function boot()
{
\Illuminate\Foundation\Application::boot();
}