/**
  * Method to test getPhrase().
  *
  * @return void
  *
  * @covers \Windwalker\Http\Helper\ResponseHelper::getPhrase
  */
 public function testGetPhrase()
 {
     $this->assertEquals('OK', ResponseHelper::getPhrase(200));
     $this->assertEquals('Moved Permanently', ResponseHelper::getPhrase(301));
     $this->assertEquals('Found', ResponseHelper::getPhrase(302));
     $this->assertEquals('Temporary Redirect', ResponseHelper::getPhrase(307));
     $this->assertEquals('Forbidden', ResponseHelper::getPhrase(403));
     $this->assertEquals('Not Found', ResponseHelper::getPhrase(404));
     $this->assertEquals('Internal Server Error', ResponseHelper::getPhrase(500));
 }
Ejemplo n.º 2
0
 /**
  * Gets the response reason phrase associated with the status code.
  *
  * Because a reason phrase is not a required element in a response
  * status line, the reason phrase value MAY be null. Implementations MAY
  * choose to return the default RFC 7231 recommended reason phrase (or those
  * listed in the IANA HTTP Status Code Structure) for the response's
  * status code.
  *
  * @link http://tools.ietf.org/html/rfc7231#section-6
  * @link http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
  *
  * @return  string  Reason phrase; must return an empty string if none present.
  */
 public function getReasonPhrase()
 {
     if (!$this->reasonPhrase) {
         $this->reasonPhrase = ResponseHelper::getPhrase($this->statusCode);
     }
     return $this->reasonPhrase;
 }