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;
 }
 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());
 }
Exemple #3
0
 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://*****:*****@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;
 }
Exemple #4
0
 /**
  * Get the loader implementation.
  *
  * @return \Illuminate\Config\LoaderInterface 
  * @static 
  */
 public static function getLoader()
 {
     return \Illuminate\Config\Repository::getLoader();
 }
 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;
 }
Exemple #6
0
 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();
 }
 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());
 }