예제 #1
0
 public function testNotAcceptCustom()
 {
     $this->setExpectedException('\\Nano\\Exception\\NotFound', 'Custom dispatcher fails');
     $response = new \Nano\Controller\Response\Test();
     $this->dispatcher->setResponse($response)->throwExceptions(true)->dispatch(new \Nano\Routes(), '');
 }
예제 #2
0
 public function testGetResponseShouldCreateInstanceWhenNull()
 {
     self::setObjectProperty($this->dispatcher, 'response', null);
     self::assertInstanceOf('\\Nano\\Controller\\Response', $this->dispatcher->getResponse());
 }
예제 #3
0
파일: Controller.php 프로젝트: visor/nano
 /**
  * @return void
  */
 protected function runContextAction()
 {
     if (!$this->context) {
         return;
     }
     $method = \Nano\Application\Dispatcher::formatName($this->dispatcher()->action() . '-' . $this->context, false);
     if (!method_exists($this, $method)) {
         return;
     }
     $this->{$method}();
 }
예제 #4
0
 public function testGetControllerShouldThrowWhenAbstractClassRequired()
 {
     $this->setExpectedException('\\Nano\\Exception\\InternalError', 'Not a controller class: App\\Controller\\AbstractController');
     require_once __DIR__ . '/_files/controllers/AbstractController.php';
     $this->dispatcher->getController(\Nano\Route\Common::create('', 'abstract-controller', 'test'));
 }