I really like how Pest PHP formats and outputs test results, but I still prefer to use PHPUnit. Luckily there's Collision. This package is designed to give you beautiful error reporting when interacting with your app through the command line.
composer require robiningelbrecht/phpunit-pretty-print --devNavigate to your phpunit.xml.dist file and add following config to set default options
(you can also set these options at run time):
<extensions>
<bootstrap class="RobinIngelbrecht\PHPUnitPrettyPrint\PhpUnitExtension">
</bootstrap>
</extensions>Also make sure the color attribute is set to true:
<phpunit
colors="true">
</phpunit>All these options can be set at runtime as well, see usage.
<extensions>
<bootstrap class="RobinIngelbrecht\PHPUnitPrettyPrint\PhpUnitExtension">
<parameter name="displayProfiling" value="true"/>
</bootstrap>
</extensions><extensions>
<bootstrap class="RobinIngelbrecht\PHPUnitPrettyPrint\PhpUnitExtension">
<parameter name="useCompactMode" value="true"/>
</bootstrap>
</extensions><extensions>
<bootstrap class="RobinIngelbrecht\PHPUnitPrettyPrint\PhpUnitExtension">
<parameter name="displayQuote" value="true"/>
</bootstrap>
</extensions>This can be useful when you only want to prettify the output when forced via CLI (see usage).
<extensions>
<bootstrap class="RobinIngelbrecht\PHPUnitPrettyPrint\PhpUnitExtension">
<parameter name="enableByDefault" value="false"/>
</bootstrap>
</extensions>> vendor/bin/phpunit> vendor/bin/phpunit -d --profiling> vendor/bin/phpunit -d --compact> vendor/bin/phpunit -d --display-quote> vendor/bin/phpunit -d --enable-pretty-print
> vendor/bin/phpunit -d --disable-pretty-print> vendor/bin/phpunit --configuration=tests/phpunit.test.xml -d --compact -d --display-quoteThis package does not support PHPUnit 9.x but Collision does out of the box. Run
composer require nunomaduro/collision:^6.0Then add the Collision printerClass to your phpunit.xml in the phpunit section:
<phpunit
printerClass="NunoMaduro\Collision\Adapters\Phpunit\Printer">- API used for Chuck Noris quotes: https://api.chucknorris.io/
- CLI formatting: https://github.com/nunomaduro/collision




