承接 tdd-guard/phpunit 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

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

License

MIT

统计信息

  • 总下载量: 669
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-30