コード例 #1
0
 public function testStringOutput()
 {
     // Set our manual test data
     $code = 404;
     $expected_string = '404 Not Found';
     // Create and echo our status
     $http_status = new HttpStatus($code);
     echo $http_status;
     $this->expectOutputString($expected_string);
     $this->assertSame($expected_string, $http_status->getFormattedString());
 }
コード例 #2
0
ファイル: Response.php プロジェクト: sankarganeshsiva/open
 /**
  * Get (or set) the HTTP response code
  *
  * Simply calling this method without any arguments returns the current response code.
  * Calling with an integer argument, however, attempts to set the response code to what
  * was provided by the argument.
  *
  * @param int $code     The HTTP status code to send
  * @access public
  * @return int|Response
  */
 public function code($code = null)
 {
     if (null !== $code) {
         // Require that the response be unlocked before changing it
         $this->requireUnlocked();
         $this->status = new HttpStatus($code);
         return $this;
     }
     return $this->status->getCode();
 }