定制 mathrix-education/openapi-assertions 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mathrix-education/openapi-assertions

Composer 安装命令:

composer require mathrix-education/openapi-assertions

包简介

Validate PSR-7 requests against OpenAPI specification. Heavily based on league/openapi-psr7-validator.

README 文档

README

version license php-version

Base library of all Mathrix Education SA PHP projects.

Allow to test API responses against an OpenAPI v3 specification. Proudly maintained by Mathieu Bour mathieu@mathrix.fr, Vice-CTO.

The library heavily relies on league/openapi-psr7-validator formerly lezhnev74/openapi-psr7-validator.

Lumen

In order to use OpenAPI assertions with lumen, you need to install symfony/psr-http-message-bridge and nyholm/psr7. You can do it with:

composer require --dev nyholm/psr7 symfony/psr-http-message-bridge

Then, add the LumenOpenAPIAssertions trait to your base TestCase, like so:

use \Mathrix\OpenAPI\Assertions\Lumen\LumenOpenAPIAssertions;

class TestCase extends LumenTestCase {
    use LumenOpenAPIAssertions;
    
    public static function setupBeforeClass()
    {
        self::$openAPISpecificationPath = PATH_TO_SPEC_YAML;
        self::bootLumenOpenAPIAssertions();
    }
}

Usage

To test that an Illuminate Response matches the specification, simply run:

class TestBar extends TesCase {
    public function testFoo() {
        // Your test code
        $this->assertOpenAPIResponse($response); // Where response extends \Illuminate\Http\Response
    }
}

统计信息

  • 总下载量: 349
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-12-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固