josrom/phpunit-unicode-printer
最新稳定版本:13.0.0
Composer 安装命令:
composer require josrom/phpunit-unicode-printer
包简介
Printer for PHPUnit using Unicode
README 文档
README
Requirements
- PHP 8.4+
- PHPUnit 13.x
Installation
Require the package with Composer:
composer require --dev josrom/phpunit-unicode-printer:13.*
Or update your require-dev block manually and run composer update:
{
"require-dev": {
"josrom/phpunit-unicode-printer": "13.*"
}
}
Configuration (PHPUnit 10 / 11 / 12 / 13)
PHPUnit 10 removed the printerClass XML attribute and replaced the printer
architecture with an event-driven extension system, which PHPUnit 11, 12 and 13
keep. Register the printer as a <bootstrap> extension in your phpunit.xml:
<phpunit ... colors="true" ...> <extensions> <bootstrap class="PHPUnit\Extension\UnicodePrinterMethod"/> </extensions> ... </phpunit>
Pick one of the three available extensions depending on the level of detail you want:
| Extension class | Output |
|---|---|
PHPUnit\Extension\UnicodePrinter |
One progress symbol per test, grouped by test directory. |
PHPUnit\Extension\UnicodePrinterClass |
One progress symbol per test, grouped by directory + class. |
PHPUnit\Extension\UnicodePrinterMethod |
One full row per test ((N/M) ✓ Class: Method (Xms)). |
Status symbols
| Status | Symbol | Color |
|---|---|---|
| Passed | ✓ | green |
| Failed | ✗ | red |
| Errored | ✗ | magenta |
| Warning | ✗ | yellow |
| Risky | ✓ | yellow |
| Deprecation | ⚠ | yellow |
| Notice | ℹ | cyan |
| Incomplete | ✓ | blue |
| Skipped | ✗ | blue |
To make a test be flagged as Risky, set
beStrictAboutTestsThatDoNotTestAnything="true" on <phpunit> and write a
test method without any assertion.
Disable PHPUnit's default progress output
PHPUnit 10/11/12/13 always renders its own dotted progress (.IIFWES…). To avoid two
progress streams interleaving, run PHPUnit with the --no-progress flag:
./vendor/bin/phpunit --no-progress
A convenient way is to alias it in your composer.json scripts section:
{
"scripts": {
"test": "phpunit --no-progress"
}
}
Note:
--no-progressis a CLI-only option; there is no equivalent attribute on the<phpunit>element.
Migrating from older versions
The old printerClass="..." attribute was removed by PHPUnit 10. Replace any
of these:
<phpunit printerClass="PHPUnit\Printer" ...> <phpunit printerClass="PHPUnit\PrinterClass" ...> <phpunit printerClass="PHPUnit\PrinterMethod" ...>
with the corresponding <extensions> block shown above. The original three
class names map to the new ones as:
| Before (PHPUnit ≤ 9) | After (PHPUnit 10 / 11 / 12 / 13) |
|---|---|
PHPUnit\Printer |
PHPUnit\Extension\UnicodePrinter |
PHPUnit\PrinterClass |
PHPUnit\Extension\UnicodePrinterClass |
PHPUnit\PrinterMethod |
PHPUnit\Extension\UnicodePrinterMethod |
Older PHPUnit versions
For previous versions of PHPUnit use these tags:
| PHPUnit | Tag |
|---|---|
| 12 | 12.* |
| 11 | 11.* |
| 10 | 10.* |
| 9 | 9.* |
| 8 | 0.4.* or 8.* |
| 7 | 0.3.* or 7.* |
| 6 | 0.2.* |
| <5 | 0.1.* |
统计信息
- 总下载量: 23.97k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-01-19