Skip to content

Commit 40a1693

Browse files
committed
tests: added test
1 parent c5f64c7 commit 40a1693

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

tests/Http/Response.headers.phpt

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
/**
4+
* Test: Nette\Http\Response headers
5+
*/
6+
7+
use Nette\Http;
8+
use Tester\Assert;
9+
10+
11+
require __DIR__ . '/../bootstrap.php';
12+
13+
if (PHP_SAPI === 'cli') {
14+
Tester\Environment::skip('Headers are not available in CLI');
15+
}
16+
17+
18+
$old = headers_list();
19+
$response = new Http\Response;
20+
21+
$response->setHeader('replace', 'one');
22+
$response->setHeader('replace', 'two');
23+
24+
$response->addHeader('append', 'one');
25+
$response->addHeader('append', 'two');
26+
27+
28+
Assert::same('two', $response->getHeader('replace'));
29+
Assert::same('two', $response->getHeader('REPLACE'));
30+
31+
Assert::same('one', $response->getHeader('append'));
32+
Assert::same('one', $response->getHeader('APPEND'));
33+
34+
$headers = $response->getHeaders();
35+
Assert::contains('two', $headers['replace']);
36+
Assert::contains('two', $headers['append']);

0 commit comments

Comments
 (0)