定制 webmaesther/pest-plugin-contract 二次开发

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

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

webmaesther/pest-plugin-contract

Composer 安装命令:

composer require --dev webmaesther/pest-plugin-contract

包简介

Pest plugin to define contract tests

README 文档

README

This repository contains the Pest Plugin Contract.

If you want to start testing your application with Pest, visit the main Pest Repository.

Requirements

  • Pest v4

Installation

composer require webmaesther/pest-plugin-contract --dev

Usage

Define your contracts anywhere in your test folder in *Contract.php files.

contract('is string', function() {
    
    test('its type is string', function(mixed $value) {
    
        expect($value)->toBeString();
    })
});

Then you can use your contracts in any of your test files.

fulfill('is string')->with(['string']);

The fullfill function simply creates a describe block out of your contract closure, and includes it in your test file, exactly where you put it, as if you yourself would have written it. Thus, you can use any method on it that you would use on a describe block. Most notably you will need the with() method, which you should use to parametrize your tests with any Pest compatible dataset you like.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-08-31