Skip to content

Commit f402e2c

Browse files
committed
Update PHPUnit requirement to ^8.0 || ^9.0
In order to ensure the code works on PHP 8 as well the inspections should also run on PHP 8. As the library runs perfectly fine on PHP 7.2 and PHP 7.3 I don't see a necessity to drop support for those versions. In order to still support PHP 8 PHPUnit needs to be updated to version 9, but that version drops support for PHP 7.2 and PHP 7.3. The solution is to require either PHPUnit 8 or PHPUnit 9. This left an issue with the usage of Prophecy as Prophecy is deprecated in PHPUnit 9. As the test suite is so small the solution for this project has been to add `phpspec/prophecy` as a direct development dependency and using Prophecy direct instead of via `\PHPUnit\Framework\TestCase::prophesize()`.
1 parent abd9443 commit f402e2c

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"psr/http-message": "^1.0"
1010
},
1111
"require-dev": {
12-
"phpunit/phpunit": "^8.0",
12+
"phpspec/prophecy": "^1.12",
13+
"phpunit/phpunit": "^8.0 || ^9.0",
1314
"squizlabs/php_codesniffer": "^3.5"
1415
},
1516
"autoload": {

tests/MiddlewareClientTest.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Coolblue\Http\Client\MiddlewareInterface;
99
use PHPUnit\Framework\TestCase;
1010
use Prophecy\Argument;
11+
use Prophecy\Prophet;
1112
use Psr\Http\Client\ClientInterface;
1213
use Psr\Http\Message\RequestInterface;
1314
use Psr\Http\Message\ResponseInterface;
@@ -18,10 +19,12 @@ public function testHandlingOfMiddlewareInCorrectOrder(): void
1819
{
1920
$order = [];
2021

21-
$request = $this->prophesize(RequestInterface::class);
22-
$response = $this->prophesize(ResponseInterface::class);
22+
$prophet = new Prophet();
2323

24-
$middlewareOne = $this->prophesize(MiddlewareInterface::class);
24+
$request = $prophet->prophesize(RequestInterface::class);
25+
$response = $prophet->prophesize(ResponseInterface::class);
26+
27+
$middlewareOne = $prophet->prophesize(MiddlewareInterface::class);
2528
$middlewareOne->process(Argument::type(RequestInterface::class), Argument::type(ClientInterface::class))
2629
->shouldBeCalled()
2730
->will(function (array $arguments) use (&$order) {
@@ -32,7 +35,7 @@ public function testHandlingOfMiddlewareInCorrectOrder(): void
3235
return $response;
3336
});
3437

35-
$middlewareTwo = $this->prophesize(MiddlewareInterface::class);
38+
$middlewareTwo = $prophet->prophesize(MiddlewareInterface::class);
3639
$middlewareTwo->process(Argument::type(RequestInterface::class), Argument::type(ClientInterface::class))
3740
->shouldBeCalled()
3841
->will(function (array $arguments) use (&$order) {
@@ -44,7 +47,7 @@ public function testHandlingOfMiddlewareInCorrectOrder(): void
4447
return $response;
4548
});
4649

47-
$client = $this->prophesize(ClientInterface::class);
50+
$client = $prophet->prophesize(ClientInterface::class);
4851
$client->sendRequest(Argument::type(RequestInterface::class))
4952
->shouldBeCalledOnce()
5053
->will(function () use (&$order, $response) {

0 commit comments

Comments
 (0)