PHP code example of gertjuhh / symfony-openapi-validator
1. Go to this page and download the library: Download gertjuhh/symfony-openapi-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/ */
gertjuhh / symfony-openapi-validator example snippets
use Gertjuhh\SymfonyOpenapiValidator\StaticOpenApiValidatorCache;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
StaticOpenApiValidatorCache::$validatorCache = new ArrayAdapter(storeSerialized: false);
declare(strict_types=1);
namespace App\ApplicationTests;
use Gertjuhh\SymfonyOpenapiValidator\OpenApiValidator;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
final class HelloWorldTest extends WebTestCase
{
use OpenApiValidator;
public function testHelloWorldReturnsSuccessfulResponse(): void
{
$client = self::createClient();
$client->xmlHttpRequest('GET', '/hello-world');
self::assertResponseIsSuccessful();
self::assertOpenApiSchema('public/openapi.yaml', $client);
}
}