From f63e8b0a7276ca07428194ef3d97470af9d0145b Mon Sep 17 00:00:00 2001 From: Phil Bennett Date: Wed, 20 Nov 2024 09:56:17 +0000 Subject: [PATCH] Fix mocks for psr/http-message ^2.0 --- composer.json | 2 +- tests/DispatchIntegrationTest.php | 22 +++++++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index 74c6c35..273a54a 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "nikic/fast-route": "^1.3", "psr/container": "^2.0", "psr/http-factory": "^1.0", - "psr/http-message": "^1.1|^2.0", + "psr/http-message": "^2.0", "psr/http-server-handler": "^1.0.1", "psr/http-server-middleware": "^1.0.1", "opis/closure": "^3.6.3", diff --git a/tests/DispatchIntegrationTest.php b/tests/DispatchIntegrationTest.php index 32cb738..4ceb209 100644 --- a/tests/DispatchIntegrationTest.php +++ b/tests/DispatchIntegrationTest.php @@ -164,10 +164,10 @@ public function testDispatchesExceptionRoute(): void public function testDispatchesExceptionWithJsonStrategyRoute(): void { - $request = $this->createMock(ServerRequestInterface::class); + $request = $this->createMock(ServerRequestInterface::class); $response = $this->createMock(ResponseInterface::class); - $uri = $this->createMock(UriInterface::class); - $body = $this->createMock(StreamInterface::class); + $uri = $this->createMock(UriInterface::class); + $body = $this->createMock(StreamInterface::class); $uri ->expects($this->exactly(2)) @@ -683,9 +683,9 @@ public function testRouterSetsGroupStrategyOnGroupUriMatchButNoRouteMatch(): voi public function testRouteStrategyOverridesGlobalStrategy(): void { - $request = $this->createMock(ServerRequestInterface::class); + $request = $this->createMock(ServerRequestInterface::class); $response = $this->createMock(ResponseInterface::class); - $uri = $this->createMock(UriInterface::class); + $uri = $this->createMock(UriInterface::class); $request ->expects($this->once()) @@ -705,6 +705,12 @@ public function testRouteStrategyOverridesGlobalStrategy(): void ->willReturn($this->createMock(StreamInterface::class)) ; + $response + ->expects($this->once()) + ->method('withHeader') + ->willReturnSelf() + ; + $uri ->expects($this->exactly(2)) ->method('getPath') @@ -752,6 +758,12 @@ public function testRouteStrategyOverridesGroupStrategy(): void ->willReturn($this->createMock(StreamInterface::class)) ; + $response + ->expects($this->once()) + ->method('withHeader') + ->willReturnSelf() + ; + $uri ->expects($this->exactly(2)) ->method('getPath')