feature-ninja/testing-matrix
最新稳定版本:0.1.1
Composer 安装命令:
composer require feature-ninja/testing-matrix
包简介
Easily test multiple scenarios by creating a testing matrix
README 文档
README
Easily test multiple scenarios by creating a testing matrix
Installation
You can install the package via composer:
composer require feature-ninja/testing-matrix
Usage
Create a testing matrix from an array:
use FeatureNinja\TestingMatrix\Matrix; $matrix = Matrix::create([ 'a' => [1, 2], 'b' => [3, 4], ]); assert(iterator_to_array($matrix) === [ 'a=1 b=3' => [1, 3], 'a=1 b=4' => [1, 4], 'a=2 b=3' => [2, 3], 'a=2 b=4' => [2, 4], ]);
Usage in PHPUnit:
use FeatureNinja\TestingMatrix\Matrix; use PHPUnit\Framework\Attributes\DataProvider;use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; final class ExampleTest extends TestCase { public static function example_data_provider(): Generator { yield from Matrix::create([ 'a' => [1, 2], 'b' => [3, 4], ]); } #[Test] #[DataProvider('examples')] public function example(int $a, int $b): void { // ... } }
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 988
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-15