tflori/phpunit-printer

A printer for phpunit that prints the name of each test

v3.1.0 2022-03-18 09:55 UTC

This package is auto-updated.

Last update: 2024-10-18 15:44:09 UTC


README

This library holds different printers for phpunit.

ok ok - at the moment there is only one: TextPrinter

How to install

Use composer:

$ composer require tflori/phpunit-printer

note that there is no version defined - composer will automatically install the correct version for your php and phpunit version

Using different phpunit versions in CI

You are maybe developing a library. Then you should not commit the composer.lock and you are probably executing your unit tests on different php and phpunit versions. You will then need to modify your composer.json manually to use any matching version of phpunit and phpunit-printer:

{
  "require": {
    "phpunit/phpunit": "*",
    "tflori/phpunit-printer": "*"
  }
}

How to use

You can now start using it by passing the printer to the phpunit configuration.

Via commandline:

$ phpunit --printer PhpUnitPrinter\TextPrinter

Via configuration file:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
         printerClass="PhpUnitPrinter\TextPrinter">
    <!-- ... -->
</phpunit>

Available printer

TextPrinter

The text printer is a copy of a script I found long time ago on the net. I don't remember where I found it, and it didn't have annotations.

If someone knows who has written that printer I would appreciate a hint to honor him in the author section.

Example:
Text Printer