From a3ea393034078492c950dd1592aa0bb92839533f Mon Sep 17 00:00:00 2001 From: Jairo Correa Date: Wed, 1 Sep 2021 00:12:46 -0300 Subject: [PATCH] PHP 8 support --- .travis.yml | 1 + CHANGELOG-2.x.md | 7 ++++++- composer.json | 2 +- tests/NgrokWebServiceTest.php | 16 +++++++++++++--- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1f2b78a..77c4892 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ matrix: - php: 7.4 - php: 7.4 env: setup=lowest + - php: 8.0 sudo: false diff --git a/CHANGELOG-2.x.md b/CHANGELOG-2.x.md index 1afac55..1d0262d 100644 --- a/CHANGELOG-2.x.md +++ b/CHANGELOG-2.x.md @@ -1,6 +1,11 @@ # Changelog -## [Unreleased](https://github.com/jn-jairo/laravel-ngrok/compare/v2.0.0...2.x) +## [Unreleased](https://github.com/jn-jairo/laravel-ngrok/compare/v2.0.1...2.x) + +## [v2.0.1 (2021-09-01)](https://github.com/jn-jairo/laravel-ngrok/compare/v2.0.0...v2.0.1) + +### Added +- PHP 8 support ## [v2.0.0 (2020-09-09)](https://github.com/jn-jairo/laravel-ngrok/compare/v1.0.1...v2.0.0) diff --git a/composer.json b/composer.json index f219a55..52eb635 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": "^7.3", + "php": "^7.3|^8.0", "guzzlehttp/guzzle": "^6.3|^7.0|^8.0", "illuminate/console": "^6.0|^7.0|^8.0", "illuminate/http": "^6.0|^7.0|^8.0", diff --git a/tests/NgrokWebServiceTest.php b/tests/NgrokWebServiceTest.php index 086d57d..983459f 100644 --- a/tests/NgrokWebServiceTest.php +++ b/tests/NgrokWebServiceTest.php @@ -7,6 +7,7 @@ use JnJairo\Laravel\Ngrok\NgrokWebService; use JnJairo\Laravel\Ngrok\Tests\TestCase; use Prophecy\PhpUnit\ProphecyTrait; +use Psr\Http\Message\StreamInterface; /** * @testdox Ngrok web service @@ -28,8 +29,11 @@ public function test_get_tunnels() : void ], ]; + $stream = $this->prophesize(StreamInterface::class); + $stream->__toString()->willReturn(json_encode(['tunnels' => $tunnels]))->shouldBeCalled(); + $response = $this->prophesize(Response::class); - $response->getBody()->willReturn(json_encode(['tunnels' => $tunnels]))->shouldBeCalled(); + $response->getBody()->willReturn($stream->reveal())->shouldBeCalled(); $httpClient = $this->prophesize(Client::class); $httpClient->request( @@ -47,8 +51,11 @@ public function test_get_tunnels_empty() : void { $tunnels = []; + $stream = $this->prophesize(StreamInterface::class); + $stream->__toString()->willReturn(json_encode(['tunnels' => $tunnels]))->shouldBeCalled(); + $response = $this->prophesize(Response::class); - $response->getBody()->willReturn(json_encode(['tunnels' => $tunnels]))->shouldBeCalled(); + $response->getBody()->willReturn($stream->reveal())->shouldBeCalled(); $httpClient = $this->prophesize(Client::class); $httpClient->request( @@ -66,8 +73,11 @@ public function test_get_tunnels_invalid_json() : void { $tunnels = []; + $stream = $this->prophesize(StreamInterface::class); + $stream->__toString()->willReturn('')->shouldBeCalled(); + $response = $this->prophesize(Response::class); - $response->getBody()->willReturn('')->shouldBeCalled(); + $response->getBody()->willReturn($stream->reveal())->shouldBeCalled(); $httpClient = $this->prophesize(Client::class); $httpClient->request(