bootstrap.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace {
  3. \setlocale(\LC_ALL, 'C');
  4. \error_reporting(\E_ALL);
  5. }
  6. namespace GuzzleHttp\Test {
  7. require __DIR__.'/../vendor/autoload.php';
  8. require __DIR__.'/Server.php';
  9. use GuzzleHttp\Tests\Server;
  10. Server::start();
  11. \register_shutdown_function(static function () {
  12. Server::stop();
  13. });
  14. }
  15. // Override curl_setopt_array() and curl_multi_setopt() to get the last set curl options
  16. namespace GuzzleHttp\Handler {
  17. function curl_setopt_array($handle, array $options)
  18. {
  19. if (!empty($_SERVER['curl_test'])) {
  20. $_SERVER['_curl'] = $options;
  21. } else {
  22. unset($_SERVER['_curl']);
  23. }
  24. return \curl_setopt_array($handle, $options);
  25. }
  26. function curl_multi_setopt($handle, $option, $value)
  27. {
  28. if (!empty($_SERVER['curl_test'])) {
  29. $_SERVER['_curl_multi'][$option] = $value;
  30. } else {
  31. unset($_SERVER['_curl_multi']);
  32. }
  33. return \curl_multi_setopt($handle, $option, $value);
  34. }
  35. }