Esempio n. 1
0
 /**
  * Initialize phalcon application
  * @return PhalconApplication
  */
 protected function initPhalconApplication()
 {
     $diFactory = $this->diManager->getDI();
     $moduleHandler = $diFactory->get('moduleHandler');
     // Register autoloader
     (new Autoloader($diFactory))->register();
     // Register services and routers
     $this->diManager->initInvokableServices()->initFactoriedServices()->initRouterDi();
     // Init listeners
     (new Listener($diFactory))->listenApplicationEvents(new Listener\Application())->listenDispatchEvents(new Listener\Dispatch());
     // Register modules
     $application = new PhalconApplication($diFactory);
     $application->setEventsManager($diFactory['eventsManager']);
     $application->registerModules($moduleHandler->getRegisteredModules());
     return $application;
 }
Esempio n. 2
0
 public function testCreateErrorHandlerSuccess()
 {
     $config = ['error_handler' => ['options' => ['views_dir' => __DIR__ . '/../view/error', 'template_500' => 'error.phtml', 'template_404' => 'not-found.phtml']]];
     $diMock = $this->getMock(Di::class, ['get', 'set'], [[]]);
     $diMock->expects($this->once())->method('get')->with('config')->will($this->returnValue(new Config($config)));
     $diMock->expects($this->once())->method('set');
     $di = new DiManager($diMock);
     $di->createErrorHandler();
 }