peterfox/phpunit-toon-result-printer 问题修复 & 功能扩展

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

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

peterfox/phpunit-toon-result-printer

最新稳定版本:v1.2.0

Composer 安装命令:

composer require peterfox/phpunit-toon-result-printer

包简介

A PHPUnit results printer that works with the TOON format

README 文档

README

Latest Version on Packagist Tests Total Downloads

A PHPUnit results printer that outputs test results in TOON (Token-Oriented Object Notation) format.

This extension is specifically designed to provide compact, highly readable test results optimized for LLM (Large Language Model) consumption, helping AI agents quickly diagnose test failures.

Features

  • Compact Output: Uses TOON format to minimize token usage while remaining human-readable.
  • AI-Friendly Diagnostics: Includes file paths, line numbers, error messages, and stack traces for failed and errored tests.
  • Concise Success Reports: Passed tests only show the test name and status to keep the output focused on what needs attention.
  • PHPUnit Extension: Integrates seamlessly as a PHPUnit extension.

Installation

You can install the package via composer:

composer require peterfox/phpunit-toon-result-printer --dev

Configuration

Permanent (Recommended)

To use this printer, add it as an extension in your phpunit.xml or phpunit.xml.dist file:

<extensions>
    <bootstrap class="PeterFox\PhpUnitToonResultPrinter\ToonResultPrinterExtension" />
</extensions>

When enabled, it will suppress PHPUnit's default progress and result output, replacing it with TOON-formatted output at the end of the test execution.

Manual (CLI)

If you don't want to enable it for all test runs, you can trigger it manually using the --extension flag:

vendor/bin/phpunit --extension "PeterFox\PhpUnitToonResultPrinter\ToonResultPrinterExtension"

Example Output

For a passing test:

ok

For a failing test:

test: "Tests\\ExampleTest::test_it_fails"
status: failed
file: "tests/ExampleTest.php"
line: 16
message: "Failed asserting that false is true."
description: "Failed asserting that false is true."
stackTrace: "..."

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 16
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 0
  • Forks: 2
  • 开发语言: PHP

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固