Exemple #1
0
 /**
  * @return \Nano\Controller\Redirect
  * @param null|string $to
  * @param int $status
  */
 public function redirect($to = null, $status = 302)
 {
     if (null === $this->redirect) {
         $this->redirect = new \Nano\Controller\Redirect($this->response());
     }
     $this->markRendered();
     if (null === $to) {
         return $this->redirect;
     }
     $this->redirect->to($to, $status);
     return $this->redirect;
 }
Exemple #2
0
 public function testPermanentRedirectShouldHas301Status()
 {
     $this->redirect->to('/some/location')->permanent();
     self::assertEquals('/some/location', $this->getResponse()->getHeader('Location'));
     self::assertEquals(301, $this->getResponse()->getStatus());
 }