PHPackages                             rouxtaccess/laravel-openapi-test - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. rouxtaccess/laravel-openapi-test

ActiveLibrary

rouxtaccess/laravel-openapi-test
================================

1.4.0(1y ago)11.4k1[1 PRs](https://github.com/RouxtAccess/laravel-openapi-test/pulls)MITPHPPHP &gt;=7.4|&gt;=8.0

Since Sep 17Pushed 10mo agoCompare

[ Source](https://github.com/RouxtAccess/laravel-openapi-test)[ Packagist](https://packagist.org/packages/rouxtaccess/laravel-openapi-test)[ RSS](/packages/rouxtaccess-laravel-openapi-test/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (5)Dependencies (3)Versions (9)Used By (0)

Laravel OpenApi Test
====================

[](#laravel-openapi-test)

> Underlying logic uses [PHP Swagger Test](https://github.com/byjg/php-swagger-test) from [byjg](https://github.com/byjg)Built for use with [L5-Swagger](https://github.com/DarkaOnLine/L5-Swagger/)This was based upon [Laravel Swagger Test](https://github.com/pionl/laravel-swagger-test) from [pionl](https://github.com/pionl)

Test your routes using Laravel's underlying request testing against your API schema.

Support
-------

[](#support)

> For how the assertions work against your documentation, please check the [PHP Swagger Test](https://github.com/byjg/php-swagger-test).

Currently, this only supports json api's, it should be very easy to override any required functionality

Install
-------

[](#install)

1. Require the package

    ```
    composer require --dev rouxtaccess/laravel-openapi-test

    ```

Usage
-----

[](#usage)

Use the Laravel's TestCase and add the `ImplementsOpenApiFunctions` trait.

Add `$this->setUpOpenApiTester();` to your test's setUp function

Uses same "request building" as `ApiRequester`. For more details check the [PHP Swagger Test](https://github.com/byjg/php-swagger-test).

For validation and testing, there are methods for `validateRequest()`, `validateRequestFails()`, `sendRequest()`, `validateResponse(Response::HTTP_OK);`

For asserting response data on top of the OpenApi required spec you can use the `assertResponseHas()` helper method See example below:

```
