]> git.mxchange.org Git - friendica-addons.git/blob - dav/SabreDAV/tests/Sabre/HTTP/ResponseTest.php
removed community home addon
[friendica-addons.git] / dav / SabreDAV / tests / Sabre / HTTP / ResponseTest.php
1 <?php
2
3 require_once 'Sabre/HTTP/ResponseMock.php';
4
5 class Sabre_HTTP_ResponseTest extends PHPUnit_Framework_TestCase {
6
7     /**
8      * @var Sabre_HTTP_ResponseMock
9      */
10     private $response;
11
12     function setUp() {
13
14         $this->response = new Sabre_HTTP_ResponseMock();
15
16     }
17
18     function testGetStatusMessage() {
19
20         $msg = $this->response->getStatusMessage(200);
21         $this->assertEquals('HTTP/1.1 200 OK',$msg);
22
23     }
24
25     function testSetHeader() {
26
27         $this->response->setHeader('Content-Type','text/html');
28         $this->assertEquals('text/html', $this->response->headers['Content-Type']);
29
30
31     }
32
33     function testSendStatus() {
34
35         $this->response->sendStatus(404);
36         $this->assertEquals('HTTP/1.1 404 Not Found', $this->response->status);
37
38     }
39
40     function testSendBody() {
41
42         ob_start();
43         $response = new Sabre_HTTP_Response();
44         $response->sendBody('hello');
45         $this->assertEquals('hello',ob_get_clean());
46
47     }
48
49     function testSendBodyStream() {
50
51         ob_start();
52         $stream = fopen('php://memory','r+');
53         fwrite($stream,'hello');
54         rewind($stream);
55         $response = new Sabre_HTTP_Response();
56         $response->sendBody($stream);
57         $this->assertEquals('hello',ob_get_clean());
58
59     }
60
61 }