| Conditions | 1 |
| Paths | 1 |
| Total Lines | 24 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | public function testCreateDefaultCSRFCheckerMiddleware() |
||
| 21 | { |
||
| 22 | $faultyResponse = $this->createMock(ResponseInterface::class); |
||
| 23 | |||
| 24 | $middleware = Factory::createDefaultCSRFCheckerMiddleware($faultyResponse); |
||
|
|
|||
| 25 | |||
| 26 | self::assertInstanceOf(CSRFCheckerMiddleware::class, $middleware); |
||
| 27 | |||
| 28 | $request = $this->createMock(ServerRequestInterface::class); |
||
| 29 | |||
| 30 | $request |
||
| 31 | ->expects(self::any()) |
||
| 32 | ->method('getMethod') |
||
| 33 | ->willReturn('POST'); |
||
| 34 | |||
| 35 | self::assertSame( |
||
| 36 | $faultyResponse, |
||
| 37 | $middleware->process( |
||
| 38 | $request, |
||
| 39 | $this->createMock(RequestHandlerInterface::class) |
||
| 40 | ), |
||
| 41 | 'Faulty http response passed to the factory is returned as part of a failed CSRF validation' |
||
| 42 | ); |
||
| 43 | } |
||
| 44 | |||
| 50 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: