Пример #1
0
 function test_is_success()
 {
     $this->assertFalse(No2_HTTP::is_success(199));
     // before inf limit
     $this->assertTrue(No2_HTTP::is_success(200));
     // inferior limit
     $this->assertTrue(No2_HTTP::is_success(203));
     // mid.
     $this->assertTrue(No2_HTTP::is_success(206));
     // superior limit
     $this->assertFalse(No2_HTTP::is_success(300));
     // after sup limit
 }
 /**
  * Invoke a controller action.
  *
  * This method is responsible to call the proper action method asked. It
  * will:
  * - call before_filter() to check if this controller allow the action in
  *   the current context
  * - call the action.
  * - Forward the status code returned by the action to the view.
  *
  * @return Nothing.
  */
 public function invoke()
 {
     $status = $this->before_filter();
     if (No2_HTTP::is_success($status)) {
         $method = $this->respond_to($this->action, $this->http_method);
         $status = $this->{$method}();
     }
     if (!is_null($status)) {
         $this->view->set_status($status);
     }
 }