@@ 22-30 (lines=9) @@ | ||
19 | * @param string $httpMethod |
|
20 | * @param bool $expectedResult |
|
21 | */ |
|
22 | public function testSafeMethods(array $safeMethods, string $httpMethod, bool $expectedResult) |
|
23 | { |
|
24 | /* @var $request RequestInterface|\PHPUnit_Framework_MockObject_MockObject */ |
|
25 | $request = $this->getMockBuilder(ServerRequestInterface::class)->getMock(); |
|
26 | ||
27 | $request->expects(self::any())->method('getMethod')->willReturn($httpMethod); |
|
28 | ||
29 | self::assertSame($expectedResult, (new IsSafeHttpMethod(...$safeMethods))->__invoke($request)); |
|
30 | } |
|
31 | ||
32 | public function httpMethodsProvider() : array |
|
33 | { |
|
@@ 74-82 (lines=9) @@ | ||
71 | * @param string $httpMethod |
|
72 | * @param bool $expectedResult |
|
73 | */ |
|
74 | public function testSafeMethodsWithDefaults(string $httpMethod, bool $expectedResult) |
|
75 | { |
|
76 | /* @var $request RequestInterface|\PHPUnit_Framework_MockObject_MockObject */ |
|
77 | $request = $this->getMockBuilder(ServerRequestInterface::class)->getMock(); |
|
78 | ||
79 | $request->expects(self::any())->method('getMethod')->willReturn($httpMethod); |
|
80 | ||
81 | self::assertSame($expectedResult, IsSafeHttpMethod::fromDefaultSafeMethods()->__invoke($request)); |
|
82 | } |
|
83 | ||
84 | public function safeDefaultsMatchingProvider() : array |
|
85 | { |