@@ 202-215 (lines=14) @@ | ||
199 | } |
|
200 | } |
|
201 | ||
202 | final protected static function assertRequestBody(Schema $schema, string $path, string $method, StreamInterface $body = null, string $msg = ''): void |
|
203 | { |
|
204 | $bodySchema = $schema->getRequestBodySchema($path, mb_strtolower($method)); |
|
205 | ||
206 | if ($bodySchema) { |
|
207 | Assert::assertThat( |
|
208 | json_decode($body), |
|
209 | new JsonSchemaConstraint($bodySchema, 'request body'), |
|
210 | $msg |
|
211 | ); |
|
212 | } else { |
|
213 | Assert::assertEmpty(json_decode($body), $msg); |
|
214 | } |
|
215 | } |
|
216 | ||
217 | final protected static function assertResponseBody(Schema $schema, string $path, string $method, string $status, StreamInterface $body = null, string $msg = ''): void |
|
218 | { |
|
@@ 217-230 (lines=14) @@ | ||
214 | } |
|
215 | } |
|
216 | ||
217 | final protected static function assertResponseBody(Schema $schema, string $path, string $method, string $status, StreamInterface $body = null, string $msg = ''): void |
|
218 | { |
|
219 | $bodySchema = $schema->getResponseBodySchema($path, mb_strtolower($method), $status); |
|
220 | ||
221 | if ($bodySchema) { |
|
222 | Assert::assertThat( |
|
223 | json_decode($body), |
|
224 | new JsonSchemaConstraint($bodySchema, 'response body'), |
|
225 | $msg |
|
226 | ); |
|
227 | } else { |
|
228 | Assert::assertEmpty(json_decode($body), $msg); |
|
229 | } |
|
230 | } |
|
231 | ||
232 | final protected static function assertDefinitionSchema(Schema $schema, string $class, stdClass $actual, string $msg = ''): void |
|
233 | { |