draw / data-tester
Library base on phpunit to test your data with a fluent interface.
Installs: 20 774
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
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-12-06 03:13:53 UTC
README
This library is a wrapper around PHPUnit Assert class to be able to use a fluent interface on the data you want to test.
The library can be install via Composer/Packagist.
Here is a quick example of how to use it in a 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'); }
There is a lot more features available, just Read the Docs!