/** * @return string * @param string $action */ public function run($action) { $class = new ReflectionClass($this); $method = Nano_Dispatcher::formatName($action, false); $result = null; $this->runInit(); if (false !== $this->runBefore()) { try { $result = $this->{$method}(); } catch (Exception $e) { ErrorLog::append($e); throw $e; } } $this->runAfter(); if (false === $this->rendered) { return $this->render(null, null); } return $result; }
/** * @return string * @param string $controller * @param string $action */ protected function runAction($controller, $action) { return $this->dispatcher->clean()->run(Nano_Route::create('', $controller, $action)); }
public function testAcceptCustom() { $_COOKIE['accept'] = true; self::assertEquals('dispatched', $this->dispatcher->dispatch(new Nano_Routes(), '')); }
public function testVithVariables() { $result = $this->dispatcher->run(Nano_Route::create('', 'test', 'testvar')); $this->assertEquals('Some title. 01=foo.03=bar.', $result); }
public function testGetController() { $c = $this->dispatcher->getController(Nano_Route::create('', 'test', 'test')); $this->assertType('Nano_C', $c); $this->assertType('TestController', $c); }