From 13a5b3e055905f564ac266b4ea4c1ab6232acb23 Mon Sep 17 00:00:00 2001 From: ek9 Date: Tue, 17 Oct 2017 19:56:10 +0200 Subject: [PATCH] v3.2.0 - guzzle ~6.0 support release --- CHANGELOG.md | 11 ++++++++++- composer.json | 2 +- src/Driver/RemoteXdebug.php | 10 +++++----- tests/Driver/RemoteXdebugTest.php | 18 +++++++++++------- 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b2bea7..3026cc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,14 @@ documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [3.2.0] - 2017-10-17 - Guzzle 6.0 support release + +- Updated `guzzlehttp/guzzle` requirement from `~4.0||~5.0` to `~6.0`. We are + considering dropping `guzzlehttp` as a requirement altogether and have it as + `suggested` packages instead, as it is only required when using remote xdebug. + We are looking for feedback regarding this on + https://github.com/leanphp/behat-code-coverage/issues/15 + ## [3.1.0] - 2017-10-17 - Legacy maintenance release - Update PHP requirement to `>=5.6` (from `>=5.3.10`) @@ -48,7 +56,8 @@ disappear, this extension would still work. - Updated `vfsStream` from `1.2.*` to `1.3.*` to fix failing/skipped test - Updated versions of dependencies and code is tested to run with Behat `2.5`. -[3.2.x-dev]: https://github.com/leanphp/behat-code-coverage/compare/v3.1.0...master +[3.2.x-dev]: https://github.com/leanphp/behat-code-coverage/compare/v3.2.0...master +[3.2.0]: https://github.com/leanphp/behat-code-coverage/releases/tag/v3.2.0 [3.1.0]: https://github.com/leanphp/behat-code-coverage/releases/tag/v3.1.0 [3.0.0]: https://github.com/leanphp/behat-code-coverage/releases/tag/v3.0.0 [2.5.5]: https://github.com/leanphp/behat-code-coverage/releases/tag/v2.5.5 diff --git a/composer.json b/composer.json index 2959272..c06dc62 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "php": ">=5.6", "phpunit/php-code-coverage": "~4.0||~5.0", "behat/behat": "~3.0", - "guzzlehttp/guzzle": "~4.0||~5.0", + "guzzlehttp/guzzle": "~6.0", "symfony/config": "~2.3||~3.0", "symfony/dependency-injection": "~2.2||~3.0", "symfony/expression-language": "~2.2||~3.0", diff --git a/src/Driver/RemoteXdebug.php b/src/Driver/RemoteXdebug.php index 4ec9162..40af55a 100644 --- a/src/Driver/RemoteXdebug.php +++ b/src/Driver/RemoteXdebug.php @@ -9,7 +9,7 @@ namespace LeanPHP\Behat\CodeCoverage\Driver; use GuzzleHttp\Client; -use GuzzleHttp\Message\Response; +use GuzzleHttp\Psr7\Response; use SebastianBergmann\CodeCoverage\Driver\Driver as DriverInterface; /** @@ -80,7 +80,7 @@ public function start($determineUnusedAndDead = true) */ public function stop() { - $response = $this->sendRequest('read', ['Accept' => 'application/json']); + $response = $this->sendRequest('read', ['headers' => ['Accept' => 'application/json']]); if ($response->getStatusCode() !== 200) { throw new \Exception('remote driver fetch failed: ' . $response->getReasonPhrase()); @@ -97,7 +97,7 @@ public function stop() * @param string $endpoint * @param array $headers * - * @return GuzzleHttp\Message\Response + * @return GuzzleHttp\Psr7\Response */ private function sendRequest($endpoint, $headers = array()) { @@ -108,14 +108,14 @@ private function sendRequest($endpoint, $headers = array()) } if (isset($this->config['auth'])) { - $response = $this->client->$method( + $response = $this->client->request($method, $this->config[$endpoint]['path'], [ 'auth' => [$this->config['auth']['user'], $this->config['auth']['password']], 'headers' => $headers, ] ); } else { - $response = $this->client->$method( + $response = $this->client->request($method, $this->config[$endpoint]['path'], [ 'headers' => $headers ] diff --git a/tests/Driver/RemoteXdebugTest.php b/tests/Driver/RemoteXdebugTest.php index f102d6e..c9e5667 100644 --- a/tests/Driver/RemoteXdebugTest.php +++ b/tests/Driver/RemoteXdebugTest.php @@ -48,30 +48,34 @@ protected function setUp() ), ); - $this->response = $this->getMockBuilder('GuzzleHttp\Message\Response') + $this->response = $this->getMockBuilder('GuzzleHttp\Psr7\Response') ->disableOriginalConstructor() ->getMock(); - $request = $this->getMockBuilder('GuzzleHttp\Message\Request') + $request = $this->getMockBuilder('GuzzleHttp\Psr7\Request') ->disableOriginalConstructor() ->getMock(); - $response = $this->getMockBuilder('GuzzleHttp\Message\Response') + $response = $this->getMockBuilder('GuzzleHttp\Psr7\Response') ->disableOriginalConstructor() ->getMock(); + $response->expects($this->any()) + ->method('getStatusCode') + ->will($this->returnValue('302')); + $this->client = $this->createMock('GuzzleHttp\Client'); $this->client->expects($this->any()) - ->method('post') + ->method('request') ->will($this->returnValue($response)); $this->client->expects($this->any()) - ->method('put') + ->method('request') ->will($this->returnValue($response)); $this->client->expects($this->any()) - ->method('get') + ->method('request') ->will($this->returnValue($response)); $this->client->expects($this->any()) - ->method('delete') + ->method('request') ->will($this->returnValue($response)); }