1
0
mirror of https://github.com/guzzle/guzzle.git synced 2025-02-25 18:43:22 +01:00

Using a shutdown function rather than a destructor to terminate the test server

This commit is contained in:
Michael Dowling 2013-12-04 08:45:33 -08:00
parent 3a0787217e
commit d818788776

View File

@ -47,16 +47,7 @@ class Server
{
$this->port = $port ?: self::DEFAULT_PORT;
$this->client = new Client($this->getUrl());
}
public function __destruct()
{
try {
$this->stop();
} catch (\Exception $e) {
// Can't throw exceptions in destructor
echo "\n{$e}\n";
}
register_shutdown_function(array($this, 'stop'));
}
/**