Beispiel #1
0
 /**
  * Tests, that the redirect function throws an exception and correctly
  * passes the parameters.
  */
 public function testRedirect()
 {
     $this->createCleanResponse();
     try {
         $this->response->redirect('http://www.example.com/', 301);
         $this->fail('HttpResponse::redirect should throw a RedirectException');
     } catch (\YapepBase\Exception\RedirectException $e) {
     }
     $this->response->send();
     $this->assertEquals(301, $this->output->responseCode);
     $this->assertEquals(array('http://www.example.com/'), $this->output->headers['Location']);
 }
 /**
  * Redirects the client to the specified URL.
  *
  * @param string $url          The URL to redirect to.
  * @param int    $statusCode   The status code of the redirect (3XX).
  *
  * @return void
  *
  * @throws \YapepBase\Exception\RedirectException   To stop execution of the controller.
  */
 protected function redirectToUrl($url, $statusCode = 303)
 {
     $this->response->redirect($url, $statusCode);
     // @codeCoverageIgnoreStart
 }