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