/** * Checks if the status code does allow message body content. * @param \Brickoo\Component\Http\HttpResponse $response * @throws StatusCodeDoesNotAllowMessageBodyException * @return \Brickoo\Component\Http\HttpResponseSender */ private function checkStatusAllowsHttpMessageBodyContent(HttpResponse $response) { $statusCode = $response->getStatus()->getCode(); if ($response->getBody()->getContent() != "" && $this->statusDoesNotAllowBody($statusCode)) { throw new StatusCodeDoesNotAllowMessageBodyException($statusCode); } return $this; }
/** * @covers Brickoo\Component\Http\HttpResponse::__construct * @covers Brickoo\Component\Http\HttpResponse::getStatus */ public function testGetStatus() { $status = new HttpStatus(HttpStatus::CODE_OK); $httpResponse = new HttpResponse(new HttpVersion(HttpVersion::HTTP_1_1), $status, new HttpMessage(new HttpMessageHeader(), new HttpMessageBody())); $this->assertEquals($status, $httpResponse->getStatus()); }