PHP code example of saritasa / openapi-httpfoundation-testing

1. Go to this page and download the library: Download saritasa/openapi-httpfoundation-testing library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

saritasa / openapi-httpfoundation-testing example snippets


use Osteel\OpenApi\Testing\ResponseValidatorBuilder;

$validator = ResponseValidatorBuilder::fromYaml('my-definition.yaml')->getValidator();

// or

$validator = ResponseValidatorBuilder::fromJson('my-definition.json')->getValidator();

$validator->validate('/users', 'post', $response);

$validator->post('/users', $response);