| Conditions | 1 |
| Paths | 1 |
| Total Lines | 24 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | public function testHandler(): void |
||
| 16 | { |
||
| 17 | $response = $this->createMock(ResponseInterface::class); |
||
| 18 | |||
| 19 | $dispatcher = $this->createMock(EventDispatcherInterface::class); |
||
| 20 | $middleware = $this->createMock(MiddlewareInterface::class); |
||
| 21 | $requestHandler = $this->createMock(RequestHandlerInterface::class); |
||
| 22 | |||
| 23 | $middleware->expects($this->once()) |
||
| 24 | ->method('process') |
||
| 25 | ->willReturnCallback( |
||
| 26 | static function (ServerRequestInterface $request, RequestHandlerInterface $handler) { |
||
| 27 | return $handler->handle($request); |
||
| 28 | } |
||
| 29 | ); |
||
| 30 | $requestHandler->expects($this->once()) |
||
| 31 | ->method('handle') |
||
| 32 | ->willReturn($response); |
||
| 33 | |||
| 34 | $handler = new MiddlewareHandler($middleware, $requestHandler, $dispatcher); |
||
| 35 | |||
| 36 | $result = $handler->handle($this->createMock(ServerRequestInterface::class)); |
||
| 37 | |||
| 38 | $this->assertSame($response, $result); |
||
| 39 | } |
||
| 41 |