<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kirschbaum-development / laravel-openapi-validator example snippets
use Kirschbaum\OpenApiValidator\ValidatesOpenApiSpec;
class HttpTest extends TestCase
{
use ValidatesOpenApiSpec;
}
public function testEndpointInProgress()
{
$response = $this->withoutRequestValidation()->get('/'); // Skips request validation, still validates response
// or
$response = $this->withoutResponseValidation()->get('/'); // Validates the request, but skips response
// or
$response = $this->withoutValidation()->get('/'); // No validation
}
public function testEndpointInProgress()
{
$this->withoutRequestValidation();
$response = $this->get('/');
}
use Kirschbaum\OpenApiValidator\ValidatesOpenApiSpec;
class HttpTest extends TestCase
{
use ValidatesOpenApiSpec;
protected $responseCodesToSkip = [200]; // Will validate every response EXCEPT 200
public function testNoRedirects()
{
$this->skipResponseCode(300); // Will skip 200 and 300
$this->skipResponseCode(301, 302); // Will skip 200, 300, 301, 302
$this->skipResponseCode('3[1-2]1'); // Will skip 200, 300, 301, 302, 311, and 321
// ...
}
}