Exemplo n.º 1
0
 public function setUp()
 {
     parent::setUp();
     $di = DI::getDefault();
     $di->set('view', function () use($di) {
         $view = new View($di->get('config')->application->view->toArray());
         $path = $di->get('config')->application->moduleDir . '/Test/views';
         if (file_exists($path)) {
             $view->setViewsDir($path);
         }
         return $view;
     });
     $modules = (new ModuleLoader($di))->dump($di->get('config')->application->moduleDir, $di->get('config')->application->configDir);
     $app = new Application();
     $app->registerModules($modules);
     $this->di = $di;
 }
Exemplo n.º 2
0
 /**
  * Registers views
  *
  * @param $di
  */
 protected function registerViewComponent($di)
 {
     $di->set('view', function () use($di) {
         $viewDir = $this->dir . '/views';
         $view = new View($di->get('config')->application->view->toArray(), $viewDir);
         if (file_exists($viewDir)) {
             $view->setViewsDir($viewDir);
         }
         $view->setEventsManager($di->getShared('eventsManager'));
         return $view;
     });
 }