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
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-31