Conditions | 1 |
Paths | 1 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
18 | public function testFromInvalidExpirationTime() |
||
19 | { |
||
20 | /* @var $request ServerRequestInterface|\PHPUnit_Framework_MockObject_MockObject */ |
||
21 | $request = $this->createMock(ServerRequestInterface::class); |
||
22 | |||
23 | $request->expects(self::any())->method('getAttributes')->willReturn(['foo' => 'bar', 'baz' => 'tab']); |
||
24 | |||
25 | $exception = SessionAttributeNotFoundException::fromAttributeNameAndRequest('foo', $request); |
||
|
|||
26 | |||
27 | self::assertInstanceOf(SessionAttributeNotFoundException::class, $exception); |
||
28 | self::assertInstanceOf(UnexpectedValueException::class, $exception); |
||
29 | self::assertInstanceOf(ExceptionInterface::class, $exception); |
||
30 | self::assertSame( |
||
31 | 'Provided request contains no matching session attribute "foo", attributes ["foo","baz"] exist', |
||
32 | $exception->getMessage() |
||
33 | ); |
||
34 | } |
||
35 | } |
||
36 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.