https://github.com/abwebdevelopers/phpunit-presenter
A presentable result printer for PHPUnit
https://github.com/abwebdevelopers/phpunit-presenter
Last synced: about 1 year ago
JSON representation
A presentable result printer for PHPUnit
- Host: GitHub
- URL: https://github.com/abwebdevelopers/phpunit-presenter
- Owner: abwebdevelopers
- License: mit
- Created: 2019-09-17T01:58:47.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-06-09T08:09:40.000Z (about 6 years ago)
- Last Synced: 2025-03-24T20:13:38.560Z (over 1 year ago)
- Language: PHP
- Size: 21.5 KB
- Stars: 3
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PHPUnit Presenter
Displays the PHPUnit test results in a more presentable and friendly format. The Presenter includes timings for tests,
colour support and better displays of errors and failures.

**This has _only_ been tested with PHPUnit `^7.5`**. However, this plugin still allows PHPUnit up to `^9.0` (via composer.json) to ease dependency restrictions but please note that things may not work as expected (use at your own 'risk').
## Features
- Different formatting types depending on your preferences.
- Grouping of test cases and suites.
- Time taken for each test case.
- Optional colour support.
## How to use
Simply include this library via Composer:
```
composer require --dev abwebdevelopers/phpunit-presenter
```
And then add it to your `phpunit.xml` file as the `printerClass` attribute
```xml
```
## Configuration
The Presenter can be configured via environment variables. The following environment variables are used:
Environment Variable | Default | Description
---------------------|---------|------------
`PRESENTER_SHOW_TIMES` | `1` | Displays the time taken for test cases. Set to `0` to disable.
`PRESENTER_COLOURS` | `1` | Displays colouring of CLI output. Set to `0` to disable. It is recommended to disable colours for test environments, ie. Travis CI.
`PRESENTER_HIDE_SUCCESSFUL` | `0` | If enabled, will hide all successful tests, and only show failed or errored tests. Set to `1` to enable.
`PRESENTER_FORMAT` | `default` | Sets the format used to display results via Presenter. Valid values are `default`, `feed` and `condensed`. It is recommended to use `feed` or `condensed` for test environments, ie. Travis CI.
## Formats
There are three types of formatting of the results displayed by Presenter - `default`, `feed` and `condensed`.
`default` and `feed` display the same information (shown in the screenshot above), however, `default` uses CLI line overwriting to show real-time progress of tests. This may not work with some log readers used in test environments (such as Travis CI), so it is recommended to use `feed` for test environments.
A third format `condensed` presents test results in a condensed format closer to PHPUnit's default result printer. When using `condensed`, it is implied that `PRESENTER_SHOW_TIMES` is set to `0`. The formatting of condensed looks similar to this:

## License
MIT.