@@ -119,6 +119,9 @@ |
||
119 | 119 | return $this; |
120 | 120 | } |
121 | 121 | |
122 | + /** |
|
123 | + * @param integer $code |
|
124 | + */ |
|
122 | 125 | public function assertResponseCode($code) |
123 | 126 | { |
124 | 127 | $this->statusExpected = $code; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | // Preparing Parameters |
164 | 164 | $paramInQuery = null; |
165 | 165 | if (!empty($this->query)) { |
166 | - $paramInQuery = '?' . http_build_query($this->query); |
|
166 | + $paramInQuery = '?'.http_build_query($this->query); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | // Preparing Header |
@@ -187,11 +187,11 @@ discard block |
||
187 | 187 | |
188 | 188 | $statusReturned = null; |
189 | 189 | // Run the request |
190 | - $response = $this->handleRequest($pathName . $paramInQuery, $header); |
|
190 | + $response = $this->handleRequest($pathName.$paramInQuery, $header); |
|
191 | 191 | |
192 | 192 | // Get the response |
193 | 193 | $responseHeader = $response->getHeaders(); |
194 | - $responseBody = json_decode((string) $response->getBody(), true); |
|
194 | + $responseBody = json_decode((string)$response->getBody(), true); |
|
195 | 195 | $statusReturned = $response->getStatusCode(); |
196 | 196 | |
197 | 197 | // Assert results |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @param $schema |
83 | 83 | * @param $body |
84 | 84 | * @param $type |
85 | - * @return bool |
|
85 | + * @return null|boolean |
|
86 | 86 | * @throws NotMatchedException |
87 | 87 | */ |
88 | 88 | protected function matchString($name, $schema, $body, $type) |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @param $name |
103 | 103 | * @param $body |
104 | 104 | * @param $type |
105 | - * @return bool |
|
105 | + * @return null|boolean |
|
106 | 106 | * @throws NotMatchedException |
107 | 107 | */ |
108 | 108 | protected function matchNumber($name, $body, $type) |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @param $name |
123 | 123 | * @param $body |
124 | 124 | * @param $type |
125 | - * @return bool |
|
125 | + * @return null|boolean |
|
126 | 126 | * @throws NotMatchedException |
127 | 127 | */ |
128 | 128 | protected function matchBool($name, $body, $type) |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @param $schema |
144 | 144 | * @param $body |
145 | 145 | * @param $type |
146 | - * @return bool |
|
146 | + * @return null|boolean |
|
147 | 147 | * @throws DefinitionNotFoundException |
148 | 148 | * @throws GenericSwaggerException |
149 | 149 | * @throws InvalidDefinitionException |
@@ -189,6 +189,9 @@ discard block |
||
189 | 189 | return true; |
190 | 190 | } |
191 | 191 | |
192 | + /** |
|
193 | + * @param string $name |
|
194 | + */ |
|
192 | 195 | protected function matchTypes($name, $schema, $body) |
193 | 196 | { |
194 | 197 | if (!isset($schema['type'])) { |
@@ -241,7 +244,7 @@ discard block |
||
241 | 244 | } |
242 | 245 | |
243 | 246 | /** |
244 | - * @param $name |
|
247 | + * @param string $name |
|
245 | 248 | * @param $schema |
246 | 249 | * @param $body |
247 | 250 | * @return bool|null |
@@ -357,7 +360,7 @@ discard block |
||
357 | 360 | * @param $body |
358 | 361 | * @param $type |
359 | 362 | * @param $nullable |
360 | - * @return bool |
|
363 | + * @return null|boolean |
|
361 | 364 | * @throws NotMatchedException |
362 | 365 | */ |
363 | 366 | protected function matchNull($name, $body, $type, $nullable) |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | |
16 | 16 | abstract class Body |
17 | 17 | { |
18 | - const SWAGGER_PROPERTIES="properties"; |
|
19 | - const SWAGGER_REQUIRED="required"; |
|
18 | + const SWAGGER_PROPERTIES = "properties"; |
|
19 | + const SWAGGER_REQUIRED = "required"; |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * @var Schema |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | return new OpenApiResponseBody($schema, $name, $structure, $allowNullValues); |
73 | 73 | } |
74 | 74 | |
75 | - throw new GenericSwaggerException("Cannot get instance SwaggerBody or SchemaBody from " . get_class($schema)); |
|
75 | + throw new GenericSwaggerException("Cannot get instance SwaggerBody or SchemaBody from ".get_class($schema)); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | abstract public function match($body); |
@@ -199,32 +199,32 @@ discard block |
||
199 | 199 | $nullable = isset($schema['nullable']) ? (bool)$schema['nullable'] : $this->schema->isAllowNullValues(); |
200 | 200 | |
201 | 201 | $validators = [ |
202 | - function () use ($name, $body, $type, $nullable) |
|
202 | + function() use ($name, $body, $type, $nullable) |
|
203 | 203 | { |
204 | 204 | return $this->matchNull($name, $body, $type, $nullable); |
205 | 205 | }, |
206 | 206 | |
207 | - function () use ($name, $schema, $body, $type) |
|
207 | + function() use ($name, $schema, $body, $type) |
|
208 | 208 | { |
209 | 209 | return $this->matchString($name, $schema, $body, $type); |
210 | 210 | }, |
211 | 211 | |
212 | - function () use ($name, $body, $type) |
|
212 | + function() use ($name, $body, $type) |
|
213 | 213 | { |
214 | 214 | return $this->matchNumber($name, $body, $type); |
215 | 215 | }, |
216 | 216 | |
217 | - function () use ($name, $body, $type) |
|
217 | + function() use ($name, $body, $type) |
|
218 | 218 | { |
219 | 219 | return $this->matchBool($name, $body, $type); |
220 | 220 | }, |
221 | 221 | |
222 | - function () use ($name, $schema, $body, $type) |
|
222 | + function() use ($name, $schema, $body, $type) |
|
223 | 223 | { |
224 | 224 | return $this->matchArray($name, $schema, $body, $type); |
225 | 225 | }, |
226 | 226 | |
227 | - function () use ($name, $schema, $body, $type) |
|
227 | + function() use ($name, $schema, $body, $type) |
|
228 | 228 | { |
229 | 229 | return $this->matchDate($name, $schema, $body, $type); |
230 | 230 | } |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | return true; |
325 | 325 | } |
326 | 326 | |
327 | - if(!isset($schema['$ref']) && isset($schema['content'])) { |
|
327 | + if (!isset($schema['$ref']) && isset($schema['content'])) { |
|
328 | 328 | $schema['$ref'] = $schema['content'][key($schema['content'])]['schema']['$ref']; |
329 | 329 | } |
330 | 330 |
@@ -8,5 +8,5 @@ |
||
8 | 8 | |
9 | 9 | abstract class ApiTestCase extends TestCase |
10 | 10 | { |
11 | - use AssertRequestAgainstSchema; |
|
11 | + use AssertRequestAgainstSchema; |
|
12 | 12 | } |
@@ -36,7 +36,7 @@ |
||
36 | 36 | // Make the request |
37 | 37 | $request = new Request( |
38 | 38 | $this->method, |
39 | - $this->schema->getServerUrl() . $path, |
|
39 | + $this->schema->getServerUrl().$path, |
|
40 | 40 | $headers, |
41 | 41 | json_encode($this->requestBody) |
42 | 42 | ); |