PHP code example of religisaci / codeception-api-validator

1. Go to this page and download the library: Download religisaci/codeception-api-validator 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/ */

    

religisaci / codeception-api-validator example snippets


  $I->wantToTest('Validate request and response against OpenAPI Specification.');
  
  $I->sendGET('api/foo/bar');
  
  $I->seeRequestIsValid();
  $I->seeResponseIsValid(); 

  $I->seeRequestIsValid();
  

  $I->seeRequestIsValid();
  

  $I->seeRequestAndResponseAreValid();
  

  $schema = 'file://' . codecept_root_dir('../../web/api/documentation/swagger.yaml');
  $I->haveOpenAPISchema($schema);
  

  $schema = 'file://' . codecept_root_dir('../../web/api/documentation/swagger.yaml');
  $I->haveSwaggerSchema($schema);