3 require_once 'Sabre/HTTP/ResponseMock.php';
5 class Sabre_HTTP_ResponseTest extends PHPUnit_Framework_TestCase {
8 * @var Sabre_HTTP_ResponseMock
14 $this->response = new Sabre_HTTP_ResponseMock();
18 function testGetStatusMessage() {
20 $msg = $this->response->getStatusMessage(200);
21 $this->assertEquals('HTTP/1.1 200 OK',$msg);
25 function testSetHeader() {
27 $this->response->setHeader('Content-Type','text/html');
28 $this->assertEquals('text/html', $this->response->headers['Content-Type']);
33 function testSendStatus() {
35 $this->response->sendStatus(404);
36 $this->assertEquals('HTTP/1.1 404 Not Found', $this->response->status);
40 function testSendBody() {
43 $response = new Sabre_HTTP_Response();
44 $response->sendBody('hello');
45 $this->assertEquals('hello',ob_get_clean());
49 function testSendBodyStream() {
52 $stream = fopen('php://memory','r+');
53 fwrite($stream,'hello');
55 $response = new Sabre_HTTP_Response();
56 $response->sendBody($stream);
57 $this->assertEquals('hello',ob_get_clean());