packagedby/openapi-testing-helpers

There is no license information available for the latest version (1.0.0) of this package.

A small library to validate an OpenAPI specification from Laravel feature tests

1.0.0 2021-03-19 14:02 UTC

This package is auto-updated.

Last update: 2024-04-11 16:59:08 UTC


README

This library is a small trait which wraps around the osteel/openapi-httpfoundation-testing library.

Usage

You can use the OpenApiValidation trait in an abstract class. This makes the validateOpenApiSpec method available to classes extending the base class.

<?php

namespace Tests\Feature;

use PackagedBy\OpenApiTestingHelpers\OpenApiValidation;
use Tests\TestCase;

abstract class AbstractFeatureTest extends TestCase
{
    use OpenApiValidation;

    protected string $openApiSpecPath;

    protected function setUp(): void
    {
        parent::setUp();
        
        $this->openApiSpecPath = base_path('/path_to_spec/openapi.yaml');
    }
}