persist / apib-unit
Unit Test Helper for API-Blueprint
dev-master
2019-02-11 14:45 UTC
Requires
- php: >=7.1
- hmaus/drafter-php: ^5.0
Requires (Dev)
- codedungeon/phpunit-result-printer: ^0.19
- mockery/mockery: ^1.0
- phpunit/phpunit: ^6.0|^7.0
- roave/security-advisories: dev-master
- spatie/phpunit-watcher: ^1.3
This package is not auto-updated.
Last update: 2025-03-05 22:27:04 UTC
README
Installation
- Install Drafter.
- Add package to composer:
$ composer require goez/apib-unit --dev
Usage
// Parse API-Blueprint document, and get the endpoints.
$endpoints = (new Apib('./example.apib'))->getEndpoints();
// Get first endpoints
$endpoint = $endpoints[0];
// Get first example of the endpoint
$example = $endpoint->getExamples()[0];
// Get request of example
$request = $example->getRequests()[0];
// Get response of example
$response = $examples[0]->getResponse()[0];
// Get JSON Schema of response
$schema = $response->getSchema();
Example for Laravel API schema validating
License
MIT