draw / data-tester
基于phpunit的库,用于使用流畅的接口测试您的数据。
0.4.0
2018-08-13 00:27 UTC
Requires
- phpunit/phpunit: ^7.0|^6.0|^5.7
- symfony/property-access: ^4.0|^3.0|^2.8
This package is auto-updated.
Last update: 2024-09-06 02:40:50 UTC
README
这个库是围绕 PHPUnit Assert 类的一个包装器,以便能够在您要测试的数据上使用流畅的接口。
可以通过 Composer/Packagist 安装这个库。
以下是一个如何在 PHPUnit TestCase 中使用它的快速示例
<?php namespace Your\Project\Name; use PHPUnit\Framework\TestCase; use Draw\DataTester\Tester; class SimpleTest extends TestCase { public function test() { $data = [ 'key1' => 'value1', 'key2' => (object)['toto' => 'value'] ]; $tester = new Tester($data); $tester->assertInternalType('array') ->assertCount(2) ->path('[key1]')->assertSame('value1'); $tester->path('[key2].toto')->assertSame('value'); }
还有很多其他功能可用,请 阅读文档!