/** * Cleans the output buffer if it is active, moves its contents to the response, and stops output buffering. */ private function finalizeOutputBuffer() { // Clean out the output buffer to the response, and send the built-up response to the client if ($this->isBuffering) { $this->response->appendBody(ob_get_contents()); $this->isBuffering = false; ob_end_clean(); } }
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()); }