File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 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 ' ]);
You can’t perform that action at this time.
0 commit comments