Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Phpunit Detailed Printer Laravel Package

limedeck/phpunit-detailed-printer

A custom PHPUnit printer that replaces the default output with more informative, readable test names plus per-test execution time, so you can spot failures and slow tests quickly while the suite runs. Compatible across PHPUnit versions.

View on GitHub
Deep Wiki
Context7

Getting Started

Install via Composer: composer require --dev limedeck/phpunit-detailed-printer. Then configure PHPUnit to use the printer in phpunit.xml by adding <printer class="LimeDeck\PHPUnit\Printer" /> inside <phpunit><printer> tags. Run your tests—e.g., ./vendor/bin/phpunit—and you’ll immediately see richer output with test names, pass/fail status, and visual markers (✅, ❌, ⚠️, ⏭️) without modifying any test code.

For PHPUnit 9+ projects, ensure your composer.json explicitly requires this package as a dev dependency (no breaking changes in 6.0.0).


Implementation Patterns

  • Local Development: Ideal for day-to-day TDD workflows where fast feedback on individual test results matters more than compact output. Enables quick scanning of test runs, especially in larger suites.
  • CI Integration: Use in CI pipelines (e.g., GitHub Actions, GitLab CI) where logs must be human-readable—avoid truncated output by piping or saving logs to files and reviewing them with context. Note: PHPUnit 9+ compatibility ensures stability in modern CI environments.
  • Hybrid Output: Combine with other reporters (e.g., JUnit) for machine-consumption (e.g., via <logfile type="junit">), using detailed-printer for visual diagnostics and JUnit for reporting dashboards.
  • Environment Switching: Maintain separate phpunit.xml.dist (default printer) and phpunit.local.xml (with detailed-printer) for team consistency vs. local preference. Tip: For PHPUnit 9+, leverage the <extensions> tag to dynamically load the printer without XML overrides if needed.
  • PHPUnit 9+ Optimization: Explicitly declare the printer in phpunit.xml for PHPUnit 9+ to avoid autoloading delays:
    <phpunit>
        <extensions>
            <extension class="LimeDeck\PHPUnit\Printer"/>
        </extensions>
    </phpunit>
    

Gotchas and Tips

  • PHPUnit 9+ Compatibility: The 6.0.0 release explicitly adds support for PHPUnit 9, but PHPUnit 10+ may require manual adjustments (e.g., namespace changes or custom event listeners). Test thoroughly in your environment.
  • CI Logging Quirk: If using headless CI with suppressed ANSI, ensure your pipeline doesn’t strip colors/styling—enable --force-ansi or use phpunit-detailed-printer only in non-CI local setups unless log readability is critical.
  • Extensibility Gap: Printer remains monolithic—custom formatting or field additions require forking and modifying Printer.php. For minor tweaks (e.g., adding test duration), consider overriding output via custom logging listeners or PHPUnit 9+ event listeners.
  • Debugging Failures: Failure messages include traceback fragments, but not full stack traces—enable PHPUnit’s phpunit.xml <printer>-level <log type="tap" /> or -v verbosity flag for full details when needed.
  • Performance Note: Slight overhead in massive test suites (>1k tests)—disable in CI unless post-run review is essential. Use phpunit --printer=LimeDeck\\PHPUnit\\Printer for one-off runs.
  • Deprecation Watch: Monitor for future PHPUnit version drops (e.g., 10+). If the package lags, consider migrating to native PHPUnit reporters like --testdox or third-party alternatives like phpunit/printer.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope