tdd-guard/phpunit
最新稳定版本:0.1.3
Composer 安装命令:
composer require --dev tdd-guard/phpunit
包简介
PHPUnit reporter for TDD Guard
README 文档
README
PHPUnit reporter that captures test results for TDD Guard validation.
Requirements
- PHP 8.1+
- PHPUnit 9.0+ or 10.0+ or 11.0+ or 12.0+
- TDD Guard installed globally
Installation
composer require --dev tdd-guard/phpunit
Configuration
PHPUnit 10+ Configuration
Add the extension to your phpunit.xml:
<?xml version="1.0" encoding="UTF-8"?> <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd" bootstrap="vendor/autoload.php"> <testsuites> <testsuite name="Application Test Suite"> <directory>tests</directory> </testsuite> </testsuites> <extensions> <bootstrap class="TddGuard\PHPUnit\TddGuardExtension"> <parameter name="projectRoot" value="/absolute/path/to/project/root"/> </bootstrap> </extensions> </phpunit>
PHPUnit 9.x Configuration
Add the listener to your phpunit.xml:
<?xml version="1.0" encoding="UTF-8"?> <phpunit bootstrap="vendor/autoload.php"> <testsuites> <testsuite name="Application Test Suite"> <directory>tests</directory> </testsuite> </testsuites> <listeners> <listener class="TddGuard\PHPUnit\TddGuardListener"> <arguments> <string>/absolute/path/to/project/root</string> </arguments> </listener> </listeners> </phpunit>
Project Root Configuration
Set the project root using any ONE of these methods:
Option 1: PHPUnit Configuration (Recommended)
Use the projectRoot parameter in your phpunit.xml (see examples above).
Option 2: Environment Variable
export TDD_GUARD_PROJECT_ROOT=/absolute/path/to/project/root
Option 3: Automatic Detection
If not configured, the reporter will:
- Use the directory containing
phpunit.xml - Fall back to current working directory
Configuration Rules
- Path must be absolute
- Falls back to current directory if configuration is invalid
More Information
- Test results are saved to
.claude/tdd-guard/data/test.json - See TDD Guard documentation for complete setup
License
MIT
统计信息
- 总下载量: 669
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-07-30