ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ResponseTest.php
Go to the documentation of this file.
1<?php
2
3namespace Sabre\HTTP;
4
6
7 function testConstruct() {
8
9 $response = new Response(200, ['Content-Type' => 'text/xml']);
10 $this->assertEquals(200, $response->getStatus());
11 $this->assertEquals('OK', $response->getStatusText());
12
13 }
14
15 function testSetStatus() {
16
17 $response = new Response();
18 $response->setStatus('402 Where\'s my money?');
19 $this->assertEquals(402, $response->getStatus());
20 $this->assertEquals('Where\'s my money?', $response->getStatusText());
21
22 }
23
27 function testInvalidStatus() {
28
29 $response = new Response(1000);
30
31 }
32
33 function testToString() {
34
35 $response = new Response(200, ['Content-Type' => 'text/xml']);
36 $response->setBody('foo');
37
38 $expected = <<<HI
39HTTP/1.1 200 OK\r
40Content-Type: text/xml\r
41\r
42foo
43HI;
44 $this->assertEquals($expected, (string)$response);
45
46 }
47
48}
An exception for terminatinating execution or to throw for unit testing.
testInvalidStatus()
@expectedException InvalidArgumentException
This class represents a single HTTP response.
Definition: Response.php:12
$response