예제 #1
0
 /**
  * Relocate the user to another location. This is a specialized version
  * of redirect that differs in two points:
  *
  * - relocate() will force the browser to leave the current dialog while
  *   redirect would refresh the dialog's contents
  * - relocate() accepts all the parameters that url_for() accepts so it's
  *   no longer neccessary to chain url_for() and redirect()
  *
  * @param String $to Location to redirect to
  */
 public function relocate($to)
 {
     $from_dialog = Request::isDialog();
     if (func_num_args() > 1 || $from_dialog) {
         $to = call_user_func_array(array($this, 'url_for'), func_get_args());
     }
     if ($from_dialog) {
         $this->response->add_header('X-Location', $to);
         $this->render_nothing();
     } else {
         parent::redirect($to);
     }
 }
예제 #2
0
 function test_should_throw_exception_if_rendering_and_redirecting()
 {
     $controller = new Trails_Controller(NULL);
     $this->expectException('Trails_DoubleRenderError');
     $controller->render_nothing();
     $controller->redirect('');
 }