41 $expire = time() + 100;
52 $this->assertEquals(
null, $this->response->getCookie(
'xkey' ),
'Non-existing cookie' );
53 $this->response->setCookie(
'key',
'val', $expire, [
60 $this->assertEquals(
'val', $this->response->getCookie(
'xkey' ),
'Existing cookie' );
61 $this->assertEquals( $cookie, $this->response->getCookieData(
'xkey' ),
62 'Existing cookie (data)' );
63 $this->assertEquals( [
'xkey' => $cookie ], $this->response->getCookies(),
72 $this->assertEquals(
null, $this->response->getHeader(
'Location' ),
'Non-existing header' );
74 $this->response->header(
'Location: http://localhost/' );
77 $this->response->getHeader(
'Location' ),
81 $this->response->header(
'Location: http://127.0.0.1/' );
84 $this->response->getHeader(
'Location' ),
88 $this->response->header(
'Location: http://127.0.0.2/',
false );
91 $this->response->getHeader(
'Location' ),
92 'Same header with override disabled'
95 $this->response->header(
'Location: http://localhost/' );
98 $this->response->getHeader(
'LOCATION' ),
99 'Get header case insensitive'
107 $this->response->header(
'HTTP/1.1 200' );
108 $this->assertEquals( 200, $this->response->getStatusCode(),
'Header with no message' );
110 $this->response->header(
'HTTP/1.x 201' );
113 $this->response->getStatusCode(),
114 'Header with no message and protocol 1.x'
117 $this->response->header(
'HTTP/1.1 202 OK' );
118 $this->assertEquals( 202, $this->response->getStatusCode(),
'Normal header' );
120 $this->response->header(
'HTTP/1.x 203 OK' );
123 $this->response->getStatusCode(),
124 'Normal header with no message and protocol 1.x'
127 $this->response->header(
'HTTP/1.x 204 OK',
false, 205 );
130 $this->response->getStatusCode(),
131 'Third parameter overrides the HTTP/... header'
134 $this->response->statusHeader( 210 );
137 $this->response->getStatusCode(),
138 'Handle statusHeader method'
141 $this->response->header(
'Location: http://localhost/',
false, 206 );
144 $this->response->getStatusCode(),
145 'Third parameter with another header'