public function testAppendBodyAppendsExistingSegment() { $this->_response->setBody("some content\n", 'some'); $this->_response->appendBody("more content\n", 'some'); $content = $this->_response->getBody(true); $this->assertTrue(is_array($content)); $expected = array('some' => "some content\nmore content\n"); $this->assertEquals($expected, $content); }
public function test__toString() { $skipHeadersTest = headers_sent(); $this->_response->setHeader('Content-Type', 'text/plain'); $this->_response->setBody('Content'); $this->_response->appendBody('; and more content.'); $expected = 'Content; and more content.'; $result = $this->_response->__toString(); if (!$skipHeadersTest) { $this->assertTrue(headers_sent()); $headers = headers_list(); $found = false; foreach ($headers as $header) { if ('Content-Type: text/plain' == $header) { $found = true; } } $this->assertTrue($found, var_export($headers, 1)); } }