本文整理汇总了PHP中Illuminate\Support\Facades\Facade::setFacadeApplication方法的典型用法代码示例。如果您正苦于以下问题:PHP Facade::setFacadeApplication方法的具体用法?PHP Facade::setFacadeApplication怎么用?PHP Facade::setFacadeApplication使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Facade
的用法示例。
在下文中一共展示了Facade::setFacadeApplication方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* Bootstrap the test environemnt:
* - Create an application instance and register it within itself.
* - Register the package service provider with the app.
* - Set the APP facade.
*
* @return void
*/
public function setUp()
{
$app = new Application();
$app->instance('app', $app);
$app->register('Ideil\\LaravelFileOre\\LaravelFileOreServiceProvider');
Facade::setFacadeApplication($app);
}
示例2: bootstrap
public function bootstrap(Application $app, $config)
{
\Illuminate\Support\Facades\Facade::clearResolvedInstances();
\Illuminate\Support\Facades\Facade::setFacadeApplication($app);
#注册别名并设置自动加载器
\Illuminate\Foundation\AliasLoader::getInstance($config['app_aliases'])->register();
}
示例3: __construct
public function __construct($values = array())
{
parent::__construct();
static::$app = $this;
foreach ($values as $key => $value) {
$this[$key] = $value;
}
Facade::setFacadeApplication($this);
// register the configserviceprovider so we can access the config
$this->register(new ConfigServiceProvider());
// grab the providers from the config and load them
$providers = $this['config']->get('app/providers');
foreach ($providers as $provider) {
$this->register(new $provider());
}
// set the locale (https://github.com/silexphp/Silex/issues/983)
$locale = $values['locale'];
if ($this['translator']) {
$this['translator']->setlocale($locale);
}
// register fieldtypes from config
$fieldTypesConfig = $this['config']->get('fieldtypes');
if ($fieldTypesConfig) {
$this['fieldtypes'] = $this['fieldtypes.factory']->fromConfig($fieldTypesConfig);
}
// register contenttypes from config
$contentTypeConfig = $this['config']->get('contenttypes');
if ($contentTypeConfig) {
$this['contenttypes'] = $this['contenttypes.factory']->fromConfig($contentTypeConfig);
}
}
示例4: register
public function register()
{
$this->app->container->singleton('ioc', function () {
return new Container();
});
Facade::setFacadeApplication($this->app->ioc);
}
示例5: create
public static function create()
{
$instance = new self();
// Swap the Facade app with our container (to use these mocks)
Facade::setFacadeApplication($instance->app);
return $instance->app;
}
示例6: createApplication
/**
* Creates the application.
*
* @return \Symfony\Component\HttpKernel\HttpKernelInterface
*/
public function createApplication()
{
Facade::setFacadeApplication($app = new Application());
$app['env'] = 'testing';
$app['path'] = 'app_path';
$app['path.config'] = 'config_path';
return $app;
}
示例7: it_returns_the_schema_builder
/** @test */
public function it_returns_the_schema_builder()
{
$migration = new MigrationStub();
$mock = Mockery::mock('Illuminate\\Database\\Connection');
Facade::setFacadeApplication(['db' => $mock]);
$mock->shouldReceive('getSchemaBuilder')->once()->andReturn('foo');
$this->assertEquals('foo', $migration->getSchemaBuilder());
}
示例8: setUp
public function setUp()
{
$app = M::mock('Application');
$app = $app->shouldReceive('make')->with('path.public')->andReturn('tmp');
$app = $app->shouldReceive('make')->with('path')->andReturn('tests');
$app = $app->mock();
Facade::setFacadeApplication($app);
}
示例9: setUp
/**
* setUp method.
*/
public function setUp()
{
// Bootstrap the application container
$app = new Application();
$app->instance('app', $app);
$app->register('Codesleeve\\FixtureL4\\FixtureL4ServiceProvider');
Facade::setFacadeApplication($app);
}
示例10: testMapping
public function testMapping()
{
Facade::setFacadeApplication(new ApplicationStub());
$configuration = ['driver' => 'sqlite', 'database' => 'db', 'username' => 'somedude', 'prefix' => 'mitch_', 'charset' => 'whatevs'];
$expected = ['driver' => 'pdo_sqlite', 'path' => 'path/database/db.sqlite', 'user' => $configuration['username']];
$actual = $this->sqlMapper->map($configuration);
$this->assertEquals($expected, $actual);
}
示例11: setUp
protected function setUp()
{
$this->controller = new CommodeControllerTestSubject();
$this->applicationMock = $this->getMock('Illuminate\\Foundation\\Application', ['make']);
$this->requestMock = $this->getMock('Illuminate\\Http\\Request', ['ajax']);
$this->resolver = new Resolver($this->applicationMock);
Facade::setFacadeApplication($this->applicationMock);
parent::setUp();
}
示例12: __construct
public function __construct(array $attributes)
{
$this->encrypter = new Encrypter('088409730f085dd15e8e3a7d429dd185', 'AES-256-CBC');
$app = new Container();
$app->singleton('app', 'Illuminate\\Container\\Container');
$app->singleton('config', 'Illuminate\\Config\\Repository');
$app['config']->set('elocrypt.prefix', '__ELOCRYPT__:');
Facade::setFacadeApplication($app);
parent::__construct($attributes);
}
示例13: setUp
public function setUp()
{
parent::setUp();
/** @var \Illuminate\Foundation\Application|\PHPUnit_Framework_MockObject_Builder_InvocationMocker $app */
$app = $this->getMockBuilder('\\Illuminate\\Foundation\\Application')->disableOriginalConstructor()->getMock();
$app->method('make')->willReturn('\\GionniValeriana\\laravelAdminlte\\Adminlte');
Illuminate\Container\Container::setInstance(new Container());
Facade::setFacadeApplication($app);
$this->MockedBaseMenuItem = $this->getMockBuilder('\\SleepingOwl\\Admin\\Menu\\MenuItem')->disableOriginalConstructor()->getMock();
$this->MockedMenuItem = $this->getMockBuilder('\\GionniValeriana\\laravelAdminlte\\MenuItem')->disableOriginalConstructor()->getMock();
}
示例14: testAllWorks
public function testAllWorks()
{
$this->prepareFakeData();
$app = m::mock('AppMock');
$app->shouldReceive('instance')->once()->andReturn($app);
\Illuminate\Support\Facades\Facade::setFacadeApplication($app);
\Illuminate\Support\Facades\Config::swap($config = m::mock('ConfigMock'));
$config->shouldReceive('get')->once()->andReturn(5);
$objs = $this->r->all();
$this->assertEquals(5, count($objs));
}
示例15: stopApplication
/**
* Stop the application
*
* @return void
*/
public function stopApplication()
{
if ($this->hasApplicationBeenStarted()) {
foreach ($this->beforeApplicationDestroyedCallbacks as $callback) {
call_user_func($callback);
}
$this->app->flush();
$this->app = null;
Facade::clearResolvedInstances();
Facade::setFacadeApplication(null);
}
}