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