29 protected function setUp() {
39 $this->assertEquals(
null, $this->response->getcookie(
'key' ),
'Non-existing cookie' );
40 $this->response->setcookie(
'key',
'val' );
41 $this->assertEquals(
'val', $this->response->getcookie(
'key' ),
'Existing cookie' );
49 $this->assertEquals(
null, $this->response->getheader(
'Location' ),
'Non-existing header' );
51 $this->response->header(
'Location: http://localhost/' );
52 $this->assertEquals(
'http://localhost/', $this->response->getheader(
'Location' ),
'Set header' );
54 $this->response->header(
'Location: http://127.0.0.1/' );
55 $this->assertEquals(
'http://127.0.0.1/', $this->response->getheader(
'Location' ),
'Same header' );
57 $this->response->header(
'Location: http://127.0.0.2/',
false );
58 $this->assertEquals(
'http://127.0.0.1/', $this->response->getheader(
'Location' ),
'Same header with override disabled' );
60 $this->response->header(
'Location: http://localhost/' );
61 $this->assertEquals(
'http://localhost/', $this->response->getheader(
'LOCATION' ),
'Get header case insensitive' );
68 $this->response->header(
'HTTP/1.1 200' );
69 $this->assertEquals( 200, $this->response->getStatusCode(),
'Header with no message' );
71 $this->response->header(
'HTTP/1.x 201' );
72 $this->assertEquals( 201, $this->response->getStatusCode(),
'Header with no message and protocol 1.x' );
74 $this->response->header(
'HTTP/1.1 202 OK' );
75 $this->assertEquals( 202, $this->response->getStatusCode(),
'Normal header' );
77 $this->response->header(
'HTTP/1.x 203 OK' );
78 $this->assertEquals( 203, $this->response->getStatusCode(),
'Normal header with no message and protocol 1.x' );
80 $this->response->header(
'HTTP/1.x 204 OK',
false, 205 );
81 $this->assertEquals( 205, $this->response->getStatusCode(),
'Third parameter overrides the HTTP/... header' );
83 $this->response->header(
'Location: http://localhost/',
false, 206 );
84 $this->assertEquals( 206, $this->response->getStatusCode(),
'Third parameter with another header' );