codekandis / phpunit
`codekandis/phpunit` is a library providing several wrapper and helper classes for the package `PHPUnit`.
Installs: 526
Dependents: 32
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/codekandis/phpunit
Requires
- php: >=8.4
- dms/phpunit-arraysubset-asserts: 0.5.0
- phpunit/phpunit: ^10.5.56
Requires (Dev)
- rector/rector: ^1.2.10
- roave/security-advisories: dev-master
README
This library provides several wrappers and helper classes for the package phpunit/phpunit
.
Index
Installation
Install the latest version with
$ composer require --dev codekandis/phpunit
How to use
Using the test case wrapper
Create a new test case and inherit it from the wrapper TestCase
.
class FooTest extends TestCase { }
Using the data provider interface
Create a new data provider and implement the interface DataProviderInterface
.
class ImportantStuffDataProvider implements DataProviderInterface { #[Override] public static function provideData(): iterable { return [ 0 => [ 23, 42 ], 1 => [ 'foo', 'bar' ] ]; } }
Use the data provider in your test case.
<?php declare( strict_types = 1 ); use CodeKandis\PhpUnit\TestCase; class FooTest extends TestCase { #[DataProviderExternal( ImportantStuffDataProvider::class, 'provideData' )] testImportantStuff( string $value1, string $value2 ) { } }