1 | <?php |
||
12 | class HttpRequestAdapterTest extends \PHPUnit_Framework_TestCase |
||
13 | { |
||
14 | /** |
||
15 | * {@inheritDoc} |
||
16 | */ |
||
17 | protected $backupGlobals = false; |
||
18 | |||
19 | /** |
||
20 | * Ensure that the Request class returned is a PSR-7 interface |
||
21 | */ |
||
22 | public function testReturnsPsr7CompliantClass() |
||
28 | |||
29 | /** |
||
30 | * Ensure that the returned interface is immutable as per PSR-7 specs |
||
31 | */ |
||
32 | public function testGetImmutableInterfaceAfterChangingQueryParams() |
||
43 | |||
44 | /** |
||
45 | * Test that POSTed data from the request body can be returned |
||
46 | */ |
||
47 | public function testPostedDataCanBeReturned() |
||
54 | |||
55 | /** |
||
56 | * Test that a PSR-7 interface can be imported into a HTTPRequest interface |
||
57 | */ |
||
58 | public function testGetHttpRequestFromPsr7Interface() |
||
71 | |||
72 | /** |
||
73 | * @param string $method |
||
74 | * @param string $uri |
||
75 | * @param array $get |
||
76 | * @param array $post |
||
77 | * @param string $body |
||
78 | * @return ServerRequestInterface |
||
79 | */ |
||
80 | protected function getInterface($method, $uri, $get = [], $post = [], $body = null) |
||
87 | |||
88 | /** |
||
89 | * @return array |
||
90 | */ |
||
91 | protected function mockRequestData() |
||
101 | } |
||
102 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: