Пример #1
0
 /**
  * Tests WindForward->forwardAction()
  * @dataProvider dataForForwardAction
  */
 public function testForwardAction($action, $args, $isRedirect, $immediately)
 {
     if ($immediately) {
         try {
             $this->WindForward->forwardAction($action, $args, $isRedirect, $immediately);
         } catch (WindForwardException $e) {
             $this->assertEquals(array($action, $args, $isRedirect, true), array($e->getForward()->getAction(), $e->getForward()->getArgs(), $e->getForward()->getIsRedirect(), $e->getForward()->getIsReAction()));
             return;
         }
         $this->fail("ForwardAction Test Error!");
     } else {
         $this->WindForward->forwardAction($action, $args, $isRedirect, $immediately);
         $this->assertEquals(array($action, $args, $isRedirect, true), array($this->WindForward->getAction(), $this->WindForward->getArgs(), $this->WindForward->getIsRedirect(), $this->WindForward->getIsReAction()));
     }
 }
Пример #2
0
 /**
  * @param WindForward $forward
  * @param WindRouter $router
  * @param boolean $display
  * @return void
  */
 public function dispatch($forward, $router, $display)
 {
     if ($forward->getIsRedirect()) {
         $this->dispatchWithRedirect($forward, $router);
     } elseif ($forward->getIsReAction()) {
         if (count($this->maxForwrd) > 10) {
             throw new WindFinalException('[web.WindDispatcher.dispatch] more than 10 times forward request. (' . implode(', ', $this->maxForwrd) . ')');
         }
         $token = $router->getModule() . '/' . $router->getController() . '/' . $router->getAction();
         array_push($this->maxForwrd, $token);
         $this->dispatchWithAction($forward, $router, $display);
     } else {
         $view = $forward->getWindView();
         if ($view->templateName) {
             $this->getResponse()->setData($forward->getVars(), $view->templateName);
             $view->render($this->display || $display);
         }
         $this->display = false;
     }
 }