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