Core / PHPUnit quickstart
bash
composer require --dev studio-design/openapi-contract-testingCopy the minimal examples/core project. Its test validates a JSON response without a framework adapter:
php
$result = (new OpenApiResponseValidator())->validate(
'petstore', 'GET', '/pets', 200,
[['id' => 1, 'name' => 'Fido']],
'application/json',
);
self::assertTrue($result->isValid(), $result->errorMessage());Run it:
bash
composer testThe PHPUnit extension prints the endpoint coverage report after the passing test. For applications using PSR-7 messages, continue with the PSR-7 guide.