xref: /PHP-7.3/sapi/fpm/tests/getallheaders.phpt (revision 782352c5)
1--TEST--
2FPM: Function getallheaders basic test
3--SKIPIF--
4<?php include "skipif.inc"; ?>
5--FILE--
6<?php
7
8require_once "tester.inc";
9
10$cfg = <<<EOT
11[global]
12error_log = {{FILE:LOG}}
13[unconfined]
14listen = {{ADDR}}
15pm = dynamic
16pm.max_children = 5
17pm.start_servers = 1
18pm.min_spare_servers = 1
19pm.max_spare_servers = 3
20EOT;
21
22$code = <<<EOT
23<?php
24echo "Test Start\n";
25var_dump(getallheaders());
26echo "Test End\n";
27EOT;
28
29$headers = [];
30$tester = new FPM\Tester($cfg, $code);
31$tester->start();
32$tester->expectLogStartNotices();
33$tester->request(
34		'',
35		[
36			'HTTP_X_FOO' => 'BAR',
37			'HTTP_FOO'   => 'foo'
38		]
39	)->expectBody(
40		[
41			'Test Start',
42			'array(4) {',
43			'  ["Foo"]=>',
44			'  string(3) "foo"',
45			'  ["X-Foo"]=>',
46			'  string(3) "BAR"',
47			'  ["Content-Length"]=>',
48			'  string(1) "0"',
49			'  ["Content-Type"]=>',
50			'  string(0) ""',
51			'}',
52			'Test End',
53		]
54	);
55$tester->terminate();
56$tester->expectLogTerminatingNotices();
57$tester->close();
58
59?>
60Done
61--EXPECT--
62Done
63--CLEAN--
64<?php
65require_once "tester.inc";
66FPM\Tester::clean();
67?>
68