/**
  * Creates new instance of Image Manager
  *
  * @param \Illuminate\Config\Repository $config
  */
 public function __construct(\Illuminate\Config\Repository $config = null)
 {
     // create configurator
     if (is_a($config, '\\Illuminate\\Config\\Repository')) {
         $this->config = $config;
     } else {
         $config_path = __DIR__ . '/../../config';
         $env = 'production';
         $file = new Filesystem();
         $loader = new FileLoader($file, $config_path);
         $this->config = new Config($loader, $env);
         $this->config->package('intervention/image', $config_path, 'image');
     }
 }
예제 #2
0
 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;
 }
예제 #3
0
 /**
  * Register a module
  */
 public function registerModule($module)
 {
     // Register the module as a package
     $this->config->package('app/' . $module, str_finish($this->modulesDirectory, '/') . $module . '/config');
     // Add routes
     $routes = str_finish($this->modulesDirectory, '/') . $module . '/routes.php';
     if ($this->filesystem->exists($routes)) {
         $this->filesystem->getRequire($routes);
     }
     // Run module boot
     $boot = str_finish($this->modulesDirectory, '/') . $module . '/boot.php';
     if ($this->filesystem->exists($boot)) {
         $this->filesystem->getRequire($boot);
     }
 }
 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());
 }
예제 #5
0
 /**
  * Register a package for cascading configuration.
  *
  * @param string $package
  * @param string $hint
  * @param string $namespace
  * @return void 
  * @static 
  */
 public static function package($package, $hint, $namespace = null)
 {
     \Illuminate\Config\Repository::package($package, $hint, $namespace);
 }
예제 #6
0
 /**
  * Register config repository
  */
 public function registerConfigRepository()
 {
     $this->getContainer()->bindIf('config', function () {
         $dir = __DIR__ . '/../../config';
         $config = new Repository(new FileLoader($this->getFilesystem(), $dir), 'development');
         $config->package('anomaly/lexicon', $dir);
         return $config;
     }, true);
 }
예제 #7
0
 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;
 }
예제 #8
0
 /**
  * constructor
  */
 private function __construct()
 {
     $hint = realpath(__DIR__ . '/../config');
     $this->config = new Repository(new FileLoader(new Filesystem(), $hint), 'test');
     $this->config->package('eviweb/laravel4-workbench', $hint, 'workbench');
 }
예제 #9
0
 /**
  * Register a package for cascading configuration.
  *
  * @param  string  $package
  * @param  string  $hint
  * @param  string  $namespace
  * @return void
  */
 public function package($package, $hint, $namespace = null)
 {
     parent::package($package, $hint, $namespace);
     $namespaceAppPath = app_path() . '/config/' . str_replace('.', '/', $namespace);
     $this->appRepository->package($package, $namespaceAppPath, $namespace);
 }
예제 #10
0
 /**
  * Register Config Namespace
  *
  * Adds a namespace to the 'Config' instance for use with the double colon.
  *
  * @return void
  */
 protected function registerConfigNamespace()
 {
     $this->configManager->package(strtolower($this->name), $this->directory, strtolower($this->name));
     $this->configManager->addNamespace(strtolower($this->name), $this->directory . '/config');
 }
예제 #11
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();
 }
예제 #12
0
 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());
 }