Exemple #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(), '');
 }
Exemple #2
0
 public function testGetResponseShouldCreateInstanceWhenNull()
 {
     self::setObjectProperty($this->dispatcher, 'response', null);
     self::assertInstanceOf('\\Nano\\Controller\\Response', $this->dispatcher->getResponse());
 }
Exemple #3
0
 /**
  * @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}();
 }
Exemple #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'));
 }