robiningelbrecht/phpunit-pretty-print 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

robiningelbrecht/phpunit-pretty-print

最新稳定版本:v1.4.1

Composer 安装命令:

composer require --dev robiningelbrecht/phpunit-pretty-print

包简介

Prettify PHPUnit output

README 文档

README

PHPUnit

CI License PHPStan Enabled PHP PHPUnit PHPUnit

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.

Installation

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):

<extensions>
    <bootstrap class="RobinIngelbrecht\PHPUnitPrettyPrint\PhpUnitExtension">
    </bootstrap>
</extensions>

Also make sure the color attribute is set to true:

<phpunit 
        colors="true">
</phpunit>

Options

All these options can be set at runtime as well, see usage.

Output profiling report

<extensions>
    <bootstrap class="RobinIngelbrecht\PHPUnitPrettyPrint\PhpUnitExtension">
        <parameter name="displayProfiling" value="true"/>
    </bootstrap>
</extensions>

Enable compact mode

<extensions>
    <bootstrap class="RobinIngelbrecht\PHPUnitPrettyPrint\PhpUnitExtension">
        <parameter name="useCompactMode" value="true"/>
    </bootstrap>
</extensions>

Feel good about yourself after running your testsuite by displaying a Chuck Noris quote

<extensions>
    <bootstrap class="RobinIngelbrecht\PHPUnitPrettyPrint\PhpUnitExtension">
        <parameter name="displayQuote" value="true"/>
    </bootstrap>
</extensions>

Disable pretty print.

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>

Usage

> vendor/bin/phpunit

Example default

Output profiling report

> vendor/bin/phpunit -d --profiling

Example profiling

Enable compact mode

> vendor/bin/phpunit -d --compact

Example compact

Display Chuck Norris quote

> vendor/bin/phpunit -d --display-quote

Example quote

Enable/disable pretty print

> vendor/bin/phpunit -d --enable-pretty-print
> vendor/bin/phpunit -d --disable-pretty-print

Combine multiple options

> 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

composer require nunomaduro/collision:^6.0

Then add the Collision printerClass to your phpunit.xml in the phpunit section:

<phpunit
        printerClass="NunoMaduro\Collision\Adapters\Phpunit\Printer">

Acknowledgements

统计信息

  • 总下载量: 391.98k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 74
  • 点击次数: 3
  • 依赖项目数: 19
  • 推荐数: 0

GitHub 信息

  • Stars: 74
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固