コード例 #1
0
ファイル: NoaApplication.php プロジェクト: dittertp/noa
 /**
  * application starter
  *
  * @return void
  */
 public function start()
 {
     try {
         // creates the doctrine entity manager if database settings are given.
         // the instance will be stored in the object manager
         $this->createEntityManager();
         $requestHandler = $this->requestHandlerFactory->getInstance();
         $requestHandler->process();
         // process session handling after request handling is finished
         $this->sessionHandlerFactory->getInstance()->afterProcess();
     } catch (InvalidControllerException $e) {
         $this->response->setContent($e->getMessage());
         $this->response->setHttpStatus(Http::STATUS_NOT_FOUND);
     } catch (InvalidControllerActionException $e) {
         $this->response->setContent($e->getMessage());
         $this->response->setHttpStatus(Http::STATUS_NOT_FOUND);
     }
     $this->renderResponse();
 }
コード例 #2
0
 public function testGetInstance()
 {
     $uri = "/dummy";
     // @TODO: this should be also a vfs stream!
     $sessionPath = "/tmp";
     $root = vfsStream::setup('Configuration');
     $file = vfsStream::newFile('production.ini');
     $root->addChild($file);
     $file->withContent($this->iniData);
     $request = $this->getMockBuilder('\\Noa\\Core\\Http\\Request')->disableOriginalConstructor()->setMethods(array('getUri'))->getMock();
     $request->expects($this->any())->method('getUri')->will($this->returnValue($uri));
     $response = new Response();
     $configAdapter = new \Noa\ConfigurationManager\AdapterFactory(vfsStream::url("Configuration/production.ini"));
     $configManager = new Manager($configAdapter);
     $sessionHandlerFactory = new SessionHandlerFactory($configManager, $request, $response);
     $requestHandlerFactory = new RequestHandlerFactory($configManager, $sessionHandlerFactory, $request, $response);
     $requestHandler = $requestHandlerFactory->getInstance();
     $this->assertInstanceOf('Noa\\Handler\\RequestHandler\\DefaultRequestHandler', $requestHandler);
 }