Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/codekandis/phpunit

`codekandis/phpunit` is a library providing several wrapper and helper classes for the package `PHPUnit`.
https://github.com/codekandis/phpunit

classes helper php phpunit wrapper

Last synced: about 2 months ago
JSON representation

`codekandis/phpunit` is a library providing several wrapper and helper classes for the package `PHPUnit`.

Awesome Lists containing this project

README

        

# codekandis/phpunit

[![Version][xtlink-version-badge]][srclink-changelog]
[![License][xtlink-license-badge]][srclink-license]
[![Minimum PHP Version][xtlink-php-version-badge]][xtlink-php-net]

This library provides several wrappers and helper classes for the package [`phpunit/phpunit`][xtlink-packagist-phpunit-phpunit].

## Index

* [Installation](#installation)
* [How to use](#how-to-use)
* [Using the test case wrapper](#using-the-test-case-wrapper)
* [Using the data provider interface](#using-the-data-provider-interface)

## Installation

Install the latest version with

```bash
$ 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`.

```php
class FooTest extends TestCase
{
}
```

## Using the data provider interface

Create a new data provider and implement the interface `DataProviderInterface`.

```php
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