Skip to content

Make Tester extensible and framework-aware#72

Merged
rubenvanassche merged 2 commits into
mainfrom
shared-tester
May 19, 2026
Merged

Make Tester extensible and framework-aware#72
rubenvanassche merged 2 commits into
mainfrom
shared-tester

Conversation

@rubenvanassche

Copy link
Copy Markdown
Member

Summary

Tester becomes an abstract base shared by framework adapters. SymfonyTester adds Symfony Console I/O on top, frameworks like spatie/laravel-flare extend it for framework-specific pre-checks and entry-point info.

What changed

  • Tester is abstract; run() orchestrates pre-checks, sending and rendering. Write hooks (writeLine/writeNewline) are abstract and supplied by subclasses.
  • New SymfonyTester wires Symfony Console (InputInterface/OutputInterface) and provides a default CLI entry point.
  • New shared/FakeSymfonyTester.php for downstream packages that want to test their own subclass against the same harness.
  • Style constants (STYLE_PLAIN/STYLE_INFO/STYLE_WARNING/STYLE_ERROR) replace the prior level-based naming.
  • Pre-check now warns when logs would be sent with a non-DaemonSender.
  • Test trace simulates a CLI command (Command span, derived from the entry point) instead of a web request.
  • Test error report carries entry-point attributes and a Command span event.
  • Test logs have varied per-level context to better exercise the pipeline.
  • FlareProvider no longer registers Tester in the container (it's abstract now; subclasses are constructed by their owning packages).
  • symfony/console added to require.

This PR is a prerequisite for the matching laravel-flare PR which moves TestCommand's remaining logic into a LaravelTester subclass.

Tester becomes an abstract base shared by framework adapters: SymfonyTester
adds Symfony Console I/O, frameworks like laravel-flare extend it for
framework-specific pre-checks and entry point info. Adds a daemon-sender
recommendation when logs are tested with a non-daemon sender, and enriches
the test trace/log/error payloads with realistic command, entry-point and
context attributes.
@rubenvanassche rubenvanassche merged commit 68bdb2a into main May 19, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant