Skip to content

Commit

Permalink
Fix mocks for psr/http-message ^2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
philipobenito committed Nov 20, 2024
1 parent e3ad4a7 commit f63e8b0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
22 changes: 17 additions & 5 deletions tests/DispatchIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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())
Expand All @@ -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')
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit f63e8b0

Please sign in to comment.