本文整理汇总了PHP中Illuminate\Config\Repository::getLoader方法的典型用法代码示例。如果您正苦于以下问题:PHP Repository::getLoader方法的具体用法?PHP Repository::getLoader怎么用?PHP Repository::getLoader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Config\Repository
的用法示例。
在下文中一共展示了Repository::getLoader方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getApplication
public function getApplication()
{
$app = new Application();
$app->instance('path', __DIR__);
$app['path.storage'] = __DIR__ . '/storage';
// Monolog
$log = m::mock('Illuminate\\Log\\Writer');
$log->shouldReceive('getMonolog')->andReturn(m::mock('Monolog\\Logger'));
$app['log'] = $log;
// Config
$config = new Repository(m::mock('Illuminate\\Config\\LoaderInterface'), 'production');
$config->getLoader()->shouldReceive('addNamespace')->with('laravel-sentry', __DIR__);
$config->getLoader()->shouldReceive('cascadePackage')->andReturnUsing(function ($env, $package, $group, $items) {
return $items;
});
$config->getLoader()->shouldReceive('exists')->with('environments', 'laravel-sentry')->andReturn(false);
$config->getLoader()->shouldReceive('exists')->with('dsn', 'laravel-sentry')->andReturn(false);
$config->getLoader()->shouldReceive('exists')->with('level', 'laravel-sentry')->andReturn(false);
$config->getLoader()->shouldReceive('load')->with('production', 'config', 'laravel-sentry')->andReturn(array('environments' => array('prod', 'production'), 'dsn' => '', 'level' => 'error'));
$config->package('foo/laravel-sentry', __DIR__);
$app['config'] = $config;
// Env
$app['env'] = 'production';
return $app;
}
示例2: getLoader
private function getLoader()
{
// Mock application
$functions = array('functions' => array('array_get', 'fooBar' => function () {
return 'FOOBAR';
}));
$filters = array('filters' => array('camel_case', 'snakeCase' => function () {
return 'snakeCASE';
}));
$app = new Application();
$app->instance('path', __DIR__);
$config = new Repository(m::mock('Illuminate\\Config\\LoaderInterface'), 'production');
$config->getLoader()->shouldReceive('addNamespace')->with('twigbridge', __DIR__);
$config->getLoader()->shouldReceive('cascadePackage')->andReturnUsing(function ($env, $package, $group, $items) {
return $items;
});
$config->getLoader()->shouldReceive('exists')->with('functions', 'twigbridge')->andReturn(false);
$config->getLoader()->shouldReceive('exists')->with('filters', 'twigbridge')->andReturn(false);
$config->getLoader()->shouldReceive('load')->with('production', 'config', 'twigbridge')->andReturn(array_merge($functions, $filters));
$config->package('foo/twigbridge', __DIR__);
$app['config'] = $config;
// Get instance of HelperLoader
return new HelperLoader($app, new Twig_Environment());
}
示例3: getApplication
protected function getApplication($enabled = false)
{
$app = new Application();
$app['env'] = 'production';
$app['queue'] = new QueueManager($app);
$config = new Repository(m::mock('Illuminate\\Config\\LoaderInterface'), 'production');
$config->getLoader()->shouldReceive('addNamespace');
$config->getLoader()->shouldReceive('cascadePackage')->andReturnUsing(function ($env, $package, $group, $items) {
return $items;
});
$config->getLoader()->shouldReceive('exists')->with('config', 'raven')->andReturn(true);
$config->getLoader()->shouldReceive('exists')->with('dsn', 'raven')->andReturn(false);
$config->getLoader()->shouldReceive('exists')->with('enabled', 'raven')->andReturn(false);
$config->getLoader()->shouldReceive('exists')->with('level', 'raven')->andReturn(false);
$config->getLoader()->shouldReceive('exists')->with('monolog', 'raven')->andReturn(false);
$config->getLoader()->shouldReceive('load')->with('production', 'config', 'raven')->andReturn(['dsn' => 'http://123:456@foo.com/789', 'enabled' => $enabled, 'level' => 'critical', 'monolog' => ['processors' => []]]);
$config->getLoader()->shouldReceive('load')->with('production', 'services', '');
$app['config'] = $config;
$logger = new Log(new Logger('test'));
$app['log'] = $logger;
return $app;
}
示例4: getLoader
/**
* Get the loader implementation.
*
* @return \Illuminate\Config\LoaderInterface
* @static
*/
public static function getLoader()
{
return \Illuminate\Config\Repository::getLoader();
}
示例5: getApplication
public function getApplication(array $twig_options = array(), array $paths = array(), array $hints = array())
{
$app = new Application();
$app->instance('path', __DIR__);
$app['path.storage'] = __DIR__ . '/storage';
$finder = m::mock('Illuminate\\View\\ViewFinderInterface');
$finder->shouldReceive('getPaths')->andReturn($paths);
$finder->shouldReceive('getHints')->andReturn($hints);
$app['view'] = new Environment(m::mock('Illuminate\\View\\Engines\\EngineResolver'), $finder, m::mock('Illuminate\\Events\\Dispatcher'));
$config = new Repository(m::mock('Illuminate\\Config\\LoaderInterface'), 'production');
$twig_options or $twig_options = array('egg' => 'fried');
$config->getLoader()->shouldReceive('addNamespace')->with('twigbridge', __DIR__);
$config->getLoader()->shouldReceive('cascadePackage')->andReturnUsing(function ($env, $package, $group, $items) {
return $items;
});
$config->getLoader()->shouldReceive('exists')->with('extension', 'twigbridge')->andReturn(false);
$config->getLoader()->shouldReceive('exists')->with('extensions', 'twigbridge')->andReturn(false);
$config->getLoader()->shouldReceive('exists')->with('delimiters', 'twigbridge')->andReturn(false);
$config->getLoader()->shouldReceive('exists')->with('twig', 'twigbridge')->andReturn(false);
$config->getLoader()->shouldReceive('load')->with('production', 'config', 'twigbridge')->andReturn(array('extension' => 'twig', 'twig' => $twig_options, 'extensions' => array('TwigBridge\\Extensions\\Html')));
$config->package('foo/twigbridge', __DIR__);
$app['config'] = $config;
return $app;
}
示例6: testAddHandlerEnabled
public function testAddHandlerEnabled()
{
$app = new Application();
// Monolog
$log = m::mock('Illuminate\\Log\\Writer');
$monolog = m::mock('Monolog\\Logger');
$monolog->shouldReceive('pushHandler')->once();
$log->shouldReceive('getMonolog')->andReturn($monolog);
$app['log'] = $log;
// Config
$config = new Repository(m::mock('Illuminate\\Config\\LoaderInterface'), 'production');
$config->getLoader()->shouldReceive('addNamespace')->with('laravel-sentry', __DIR__);
$config->getLoader()->shouldReceive('cascadePackage')->andReturnUsing(function ($env, $package, $group, $items) {
return $items;
});
$config->getLoader()->shouldReceive('exists')->with('environments', 'laravel-sentry')->andReturn(false);
$config->getLoader()->shouldReceive('exists')->with('dsn', 'laravel-sentry')->andReturn(false);
$config->getLoader()->shouldReceive('exists')->with('level', 'laravel-sentry')->andReturn(false);
$config->getLoader()->shouldReceive('load')->with('production', 'config', 'laravel-sentry')->andReturn(array('environments' => array('prod', 'production'), 'dsn' => 'http://example.com', 'level' => 'error'));
$config->package('foo/laravel-sentry', __DIR__);
$app['config'] = $config;
$app['env'] = 'production';
$log = new Log($app);
// Raven
$raven = m::mock('Raven_Client');
$raven->shouldReceive('getFoo')->andReturn('BAR');
$log->setRaven($raven);
$log->addHandler();
}
示例7: getLoader
private function getLoader()
{
// Mock application
$aliases = array('aliases' => array('Auth' => 'Illuminate\\Support\\Facades\\Auth', 'Lookup' => 'TwigBridgeTests\\Fixtures\\Extension\\Lookup'));
$shortcuts = array('alias_shortcuts' => array('URL' => 'URL_TO', 'logged_in' => 'auth_check'));
$app = new Application();
$app->instance('path', __DIR__);
$config = new Repository(m::mock('Illuminate\\Config\\LoaderInterface'), 'production');
$config->getLoader()->shouldReceive('load')->once()->with('production', 'app', null)->andReturn($aliases);
$config->getLoader()->shouldReceive('addNamespace')->with('twigbridge', __DIR__);
$config->getLoader()->shouldReceive('cascadePackage')->andReturnUsing(function ($env, $package, $group, $items) {
return $items;
});
$config->getLoader()->shouldReceive('exists')->once()->with('alias_shortcuts', 'twigbridge')->andReturn(false);
$config->getLoader()->shouldReceive('load')->once()->with('production', 'config', 'twigbridge')->andReturn($shortcuts);
$config->package('foo/twigbridge', __DIR__);
$app['config'] = $config;
// Get instance of AliasLoader
return new AliasLoader($app, new Twig_Environment());
}