예제 #1
0
 protected function setUp()
 {
     $this->config = new \Illuminate\Config\Repository();
     $filesystem = new \Illuminate\Filesystem\Filesystem();
     $items = $filesystem->getRequire(__DIR__ . '/config/config.php');
     $this->config->set("ytake-laravel-smarty", $items);
     new \Illuminate\Config\Repository();
     $viewFinder = new \Illuminate\View\FileViewFinder($filesystem, ['views'], ['.tpl']);
     $this->factory = new \Ytake\LaravelSmarty\SmartyFactory(new \Illuminate\View\Engines\EngineResolver(), $viewFinder, new \Illuminate\Events\Dispatcher(), new Smarty(), $this->config);
     $this->factory->setSmartyConfigure();
     $this->factory->addSmartyExtension();
     $this->factory->resolveSmartyCache();
 }
예제 #2
0
 protected function setUp()
 {
     $this->config = new \Illuminate\Config\Repository();
     $filesystem = new \Illuminate\Filesystem\Filesystem();
     $items = $filesystem->getRequire(__DIR__ . '/config/config.php');
     $this->config->set("ytake-laravel-smarty", $items);
     new \Illuminate\Config\Repository();
     $viewFinder = new \Illuminate\View\FileViewFinder($filesystem, ['views'], ['.tpl']);
     $this->factory = new \Ytake\LaravelSmarty\SmartyFactory(new \Illuminate\View\Engines\EngineResolver(), $viewFinder, new \Illuminate\Events\Dispatcher(), new Smarty(), $this->config);
     $this->factory->setSmartyConfigure();
     $this->factory->resolveSmartyCache();
     $extension = $this->config->get('ytake-laravel-smarty.extension', 'tpl');
     $this->factory->addExtension($extension, 'smarty', function () {
         // @codeCoverageIgnoreStart
         return new \Ytake\LaravelSmarty\Engines\SmartyEngine($this->factory->getSmarty());
         // @codeCoverageIgnoreEnd
     });
 }
 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     $configPath = __DIR__ . '/../config/ytake-laravel-smarty.php';
     $this->mergeConfigFrom($configPath, 'ytake-laravel-smarty');
     $this->publishes([$configPath => config_path('ytake-laravel-smarty.php')]);
     $this->app->singleton('view', function ($app) {
         $factory = new SmartyFactory($app['view.engine.resolver'], $app['view.finder'], $app['events'], new Smarty(), $this->app['config']);
         // Pass the container to the factory so it can be used to resolve view composers.
         $factory->setContainer($app);
         $factory->share('app', $app);
         // add Smarty Extension
         $factory->addSmartyExtension();
         // resolve cache storage
         $factory->resolveSmartyCache();
         // smarty configure(use ytake-laravel-smarty.php)
         $factory->setSmartyConfigure();
         return $factory;
     });
 }