Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/robiningelbrecht/phpunit-pretty-print
Better PHPUnit CLI output with Collision
https://github.com/robiningelbrecht/phpunit-pretty-print
php8 phpunit10 pretty-print testing website
Last synced: 5 days ago
JSON representation
Better PHPUnit CLI output with Collision
- Host: GitHub
- URL: https://github.com/robiningelbrecht/phpunit-pretty-print
- Owner: robiningelbrecht
- License: mit
- Created: 2023-03-30T11:19:05.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-02-19T19:11:44.000Z (10 months ago)
- Last Synced: 2024-04-25T11:01:55.342Z (8 months ago)
- Topics: php8, phpunit10, pretty-print, testing, website
- Language: PHP
- Homepage: https://packagist.org/packages/robiningelbrecht/phpunit-pretty-print
- Size: 810 KB
- Stars: 62
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
Better PHPUnit CLI output
---
I really like how [Pest PHP](https://pestphp.com/) formats and outputs test results,
but I still prefer to use [PHPUnit](https://phpunit.de/). Luckily there's [Collision](https://github.com/nunomaduro/collision).
This package is designed to give you beautiful error reporting when interacting with your app through the command line.## Installation
```bash
composer require robiningelbrecht/phpunit-pretty-print --dev
```## Configuration
Navigate to your `phpunit.xml.dist` file and add following config to set default options
(you can also set these options at run time):```xml
```
Also make sure the `color` attribute is set to `true`:
```xml
```
## Options
All these options can be set at runtime as well, see usage.
### Output profiling report
```xml
```
### Enable compact mode
```xml
```
### Feel good about yourself after running your testsuite by displaying a Chuck Noris quote
```xml
```
### Disable pretty print.
This can be useful when you only want to prettify the output when forced via CLI (see usage).
```xml
```
## Usage
```bash
> vendor/bin/phpunit
```
### Output profiling report
```bash
> vendor/bin/phpunit -d --profiling
```
### Enable compact mode
```bash
> vendor/bin/phpunit -d --compact
```
### Display Chuck Norris quote
```bash
> vendor/bin/phpunit -d --display-quote
```
### Enable/disable pretty print
```bash
> vendor/bin/phpunit -d --enable-pretty-print
> vendor/bin/phpunit -d --disable-pretty-print
```### Combine multiple options
```bash
> vendor/bin/phpunit --configuration=tests/phpunit.test.xml -d --compact -d --display-quote
```## PHPUnit 9.x
This package does not support PHPUnit 9.x but Collision does out of the box. Run
```bash
composer require nunomaduro/collision:^6.0
```Then add the Collision `printerClass` to your `phpunit.xml` in the `phpunit` section:
```xml
```
## Acknowledgements* API used for Chuck Noris quotes: https://api.chucknorris.io/
* CLI formatting: https://github.com/nunomaduro/collision