1 | <?php |
||
17 | abstract class ApiTestCase extends TestCase |
||
18 | { |
||
19 | /** |
||
20 | * @var Schema |
||
21 | */ |
||
22 | protected $schema; |
||
23 | |||
24 | /** |
||
25 | * @var AbstractRequester |
||
26 | */ |
||
27 | protected $requester = null; |
||
28 | |||
29 | /** |
||
30 | * configure the schema to use for requests |
||
31 | * |
||
32 | * When set, all requests without an own schema use this one instead. |
||
33 | * |
||
34 | * @param Schema|null $schema |
||
35 | */ |
||
36 | public function setSchema($schema) |
||
40 | |||
41 | public function setRequester(AbstractRequester $requester) |
||
45 | |||
46 | /** |
||
47 | * @return AbstractRequester |
||
48 | */ |
||
49 | protected function getRequester() |
||
56 | |||
57 | /** |
||
58 | * @param string $method The HTTP Method: GET, PUT, DELETE, POST, etc |
||
59 | * @param string $path The REST path call |
||
60 | * @param int $statusExpected |
||
61 | * @param array|null $query |
||
62 | * @param array|null $requestBody |
||
63 | * @param array $requestHeader |
||
64 | * @return mixed |
||
65 | * @throws DefinitionNotFoundException |
||
66 | * @throws GenericSwaggerException |
||
67 | * @throws HttpMethodNotFoundException |
||
68 | * @throws InvalidDefinitionException |
||
69 | * @throws NotMatchedException |
||
70 | * @throws PathNotFoundException |
||
71 | * @throws StatusCodeNotMatchedException |
||
72 | * @throws MessageException |
||
73 | * @deprecated Use assertRequest instead |
||
74 | */ |
||
75 | protected function makeRequest( |
||
102 | |||
103 | /** |
||
104 | * @param AbstractRequester $request |
||
105 | * @return Response |
||
106 | * @throws DefinitionNotFoundException |
||
107 | * @throws GenericSwaggerException |
||
108 | * @throws HttpMethodNotFoundException |
||
109 | * @throws InvalidDefinitionException |
||
110 | * @throws NotMatchedException |
||
111 | * @throws PathNotFoundException |
||
112 | * @throws StatusCodeNotMatchedException |
||
113 | * @throws MessageException |
||
114 | */ |
||
115 | public function assertRequest(AbstractRequester $request) |
||
134 | |||
135 | /** |
||
136 | * @throws GenericSwaggerException |
||
137 | */ |
||
138 | protected function checkSchema() |
||
144 | } |
||
145 |
This check looks at variables that have been passed in as parameters and are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.