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

https://github.com/net-tools/phpunit-dump

Dump data generated during a PHPUnit testsuite to a file, mail, etc.
https://github.com/net-tools/phpunit-dump

Last synced: 12 months ago
JSON representation

Dump data generated during a PHPUnit testsuite to a file, mail, etc.

Awesome Lists containing this project

README

          

# net-tools/phpunit-dump

## Composer library to dump data from a PHPUnit testsuite

Sometimes we have to check some data produced by a unit test, but this can't be done with PHPUnit assertions.

This library makes it possible do dump this data to a file or to have the dump sent to a mail recipient, for further inspection.

## Setup instructions

To install net-tools/phpunit-dump package, just require it through composer : `require net-tools/phpunit-dump:^1.0.0`.

## How to use ?

The extension must be registered in PHPUnit xml config file. For example, to register `DumpToMail` extension class :

```xml





```

The other PHPUnit extension class is `DumpToFile` which write all data to files inside a given path :

```xml

```

Then, during a test, call the static method `DumpExtension::dump($name, $data)` to create a dump value ; `$data` and `$name` are string values (in the case of `DumpToFile`, `$name` will be the filename created for this dump).

At the end of the whole PHPUnit test, the values will be dumped (to files or as mail attachments).