コード例 #1
0
ファイル: C.php プロジェクト: studio-v/nano
 /**
  * @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;
 }
コード例 #2
0
ファイル: ControllerTestCase.php プロジェクト: studio-v/nano
 /**
  * @return string
  * @param string $controller
  * @param string $action
  */
 protected function runAction($controller, $action)
 {
     return $this->dispatcher->clean()->run(Nano_Route::create('', $controller, $action));
 }
コード例 #3
0
 public function testAcceptCustom()
 {
     $_COOKIE['accept'] = true;
     self::assertEquals('dispatched', $this->dispatcher->dispatch(new Nano_Routes(), ''));
 }
コード例 #4
0
ファイル: RenderTest.php プロジェクト: studio-v/nano
 public function testVithVariables()
 {
     $result = $this->dispatcher->run(Nano_Route::create('', 'test', 'testvar'));
     $this->assertEquals('Some title. 01=foo.03=bar.', $result);
 }
コード例 #5
0
ファイル: DispatcherTest.php プロジェクト: studio-v/nano
 public function testGetController()
 {
     $c = $this->dispatcher->getController(Nano_Route::create('', 'test', 'test'));
     $this->assertType('Nano_C', $c);
     $this->assertType('TestController', $c);
 }