Beispiel #1
0
 public function testBodyGetSet()
 {
     $response = new Response();
     $this->assertEquals('', $response->getBody());
     $response->setBody('Test');
     $this->assertEquals('Test', $response->getBody());
     $response->appendBody('Test');
     $this->assertEquals('TestTest', $response->getBody());
     $response->setBody('CleanTest');
     $this->assertEquals('CleanTest', $response->getBody());
 }
Beispiel #2
0
 /**
  * Triggers any "not allowed" filters and prepares an appropriate 404 error response.
  */
 private function prepareNotAllowedResponse()
 {
     ob_clean();
     $this->response = new Response();
     $this->response->setResponseCode(ResponseCode::HTTP_METHOD_NOT_ALLOWED);
     $this->context->registerInstance($this->response);
     $this->filters->trigger(Filters::METHOD_NOT_ALLOWED, $this->context);
     $this->finalizeOutputBuffer();
     if (empty($this->response->getBody())) {
         $this->serveStaticPage('method_not_allowed');
     }
 }