Skip to content

Commit 24fec4f

Browse files
committed
Add PHPUnit agent reporter to packaged config
1 parent 2e55e0c commit 24fec4f

8 files changed

Lines changed: 40 additions & 22 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Fixed
1111

12+
- Register ``ergebnis/phpunit-agent-reporter`` in the packaged ``phpunit.xml`` so AI agents receive compact PHPUnit JSON summaries without changing consumer overrides manually (#327)
1213
- Let `wiki`, `docs`, `tests`, `metrics`, and `reports` skip gracefully for guide-only repositories while keeping wiki/report workflows and published preview links aligned with the artifacts that were actually generated (#325)
1314

1415
## [1.25.0] - 2026-05-01

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"container-interop/service-provider": "^0.4.1",
4545
"dg/bypass-finals": "^1.9",
4646
"ergebnis/agent-detector": "^1.1",
47+
"ergebnis/phpunit-agent-reporter": "^0.3",
4748
"ergebnis/composer-normalize": "^2.51",
4849
"ergebnis/rector-rules": "^1.18",
4950
"fakerphp/faker": "^1.24",

docs/advanced/phpunit-extension.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ PHPUnit Extension
33

44
The packaged ``phpunit.xml`` is intentionally opinionated. Besides enabling
55
strict PHPUnit flags, it registers
6-
``FastForward\DevTools\PhpUnit\Runner\Extension\DevToolsExtension``.
6+
``FastForward\DevTools\PhpUnit\Runner\Extension\DevToolsExtension`` and
7+
``Ergebnis\PHPUnit\AgentReporter\Extension``.
78

89
Runtime Chain
910
-------------
@@ -16,6 +17,8 @@ Runtime Chain
1617
emitted during the run.
1718
4. ``FastForward\DevTools\PhpUnit\Event\TestSuite\JoliNotifExecutionFinishedSubscriber``
1819
builds a summary notification and sends it when the run finishes.
20+
5. ``Ergebnis\PHPUnit\AgentReporter\Extension`` replaces PHPUnit's normal
21+
output with a compact JSON report when an agent runtime is detected.
1922

2023
Why This Helps Consumer Projects
2124
--------------------------------
@@ -24,16 +27,18 @@ Why This Helps Consumer Projects
2427
needs it;
2528
- developers get a quick desktop summary without reading the full terminal
2629
scrollback;
30+
- agent-driven runs consume far less terminal context while still keeping
31+
failure details and PHPUnit exit semantics intact;
2732
- event counts are available to the notification layer without adding ad-hoc
2833
test code.
2934

3035
What to Remember When Overriding ``phpunit.xml``
3136
------------------------------------------------
3237

3338
If a consumer project replaces the packaged ``phpunit.xml``, it also replaces
34-
this extension unless it re-registers it manually. That is usually fine, but
35-
it explains why notifications or BypassFinals behavior may disappear after a
36-
local override.
39+
these extensions unless it re-registers them manually. That is usually fine,
40+
but it explains why notifications, BypassFinals behavior, or compact
41+
agent-oriented output may disappear after a local override.
3742

3843
.. note::
3944

docs/api/phpunit-support.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,8 @@ coverage metrics programmatically.
7171

7272
These classes are especially relevant when a consumer project overrides the
7373
packaged ``phpunit.xml`` and wants to preserve the same runtime behavior.
74+
75+
The packaged ``phpunit.xml`` also registers
76+
``Ergebnis\PHPUnit\AgentReporter\Extension`` so agent-driven PHPUnit runs can
77+
emit compact JSON summaries without changing the human-oriented default for
78+
normal terminal runs.

docs/configuration/tooling-defaults.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ create them on day one.
1818
- Fallback Rector configuration.
1919
* - ``phpunit.xml``
2020
- ``tests``
21-
- Registers ``FastForward\DevTools\PhpUnit\Runner\Extension\DevToolsExtension``.
21+
- Registers ``FastForward\DevTools\PhpUnit\Runner\Extension\DevToolsExtension`` and ``Ergebnis\PHPUnit\AgentReporter\Extension``.
2222
* - ``.php-cs-fixer.dist.php``
2323
- ``phpdoc``
2424
- Controls header and PHPDoc fixer behavior.

docs/faq.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,10 @@ Why did desktop notifications stop appearing after I customized PHPUnit?
7070
------------------------------------------------------------------------
7171

7272
If you replaced the packaged ``phpunit.xml``, you may also have removed
73-
``FastForward\DevTools\PhpUnit\Runner\Extension\DevToolsExtension``. Re-add the
74-
extension if you want the notification behavior back.
73+
``FastForward\DevTools\PhpUnit\Runner\Extension\DevToolsExtension`` and
74+
``Ergebnis\PHPUnit\AgentReporter\Extension``. Re-add them if you want the
75+
notification behavior, BypassFinals support, and compact agent-oriented output
76+
back.
7577

7678
Is ``AddMissingClassPhpDocRector`` enabled by default?
7779
------------------------------------------------------

docs/usage/testing-and-coverage.rst

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,24 @@ When ``--coverage=.dev-tools/coverage`` is used, PHPUnit writes:
4040
- ``.dev-tools/coverage/clover.xml``
4141
- ``.dev-tools/coverage/coverage.php``
4242

43-
Built-In PHPUnit Extension
44-
--------------------------
45-
46-
The packaged ``phpunit.xml`` registers
47-
``FastForward\DevTools\PhpUnit\Runner\Extension\DevToolsExtension``.
48-
49-
That extension wires together:
50-
51-
- ``FastForward\DevTools\PhpUnit\Event\TestSuite\ByPassfinalsStartedSubscriber``,
52-
which enables ``DG\BypassFinals`` when the suite starts;
53-
- ``FastForward\DevTools\PhpUnit\Event\EventTracer``, which records PHPUnit
54-
events in memory;
55-
- ``FastForward\DevTools\PhpUnit\Event\TestSuite\JoliNotifExecutionFinishedSubscriber``,
56-
which sends a desktop notification after the run when the local platform
57-
supports it.
43+
Built-In PHPUnit Extensions
44+
---------------------------
45+
46+
The packaged ``phpunit.xml`` registers:
47+
48+
- ``FastForward\DevTools\PhpUnit\Runner\Extension\DevToolsExtension``, which
49+
wires together:
50+
51+
- ``FastForward\DevTools\PhpUnit\Event\TestSuite\ByPassfinalsStartedSubscriber``,
52+
which enables ``DG\BypassFinals`` when the suite starts;
53+
- ``FastForward\DevTools\PhpUnit\Event\EventTracer``, which records PHPUnit
54+
events in memory;
55+
- ``FastForward\DevTools\PhpUnit\Event\TestSuite\JoliNotifExecutionFinishedSubscriber``,
56+
which sends a desktop notification after the run when the local platform
57+
supports it.
58+
- ``Ergebnis\PHPUnit\AgentReporter\Extension``, which replaces PHPUnit's
59+
default verbose terminal output with a compact JSON summary when an agent
60+
runtime is detected.
5861

5962
Programmatic Coverage Access
6063
-----------------------------

phpunit.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
failOnRisky="true"
1111
failOnWarning="true">
1212
<extensions>
13+
<bootstrap class="Ergebnis\PHPUnit\AgentReporter\Extension" />
1314
<bootstrap class="FastForward\DevTools\PhpUnit\Runner\Extension\DevToolsExtension" />
1415
</extensions>
1516
</phpunit>

0 commit comments

Comments
 (0)