getallheaders.phpt 1.2 KB

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