[TASK] Move TestExtension out of the shipped source - #1357
Open
CybotTM wants to merge 2 commits into
Open
Conversation
CybotTM
marked this pull request as ready for review
August 19, 2026 20:09
TestExtension is test infrastructure: it forces Parser, Compiler and the output node renderer public so tests can pull them from the container, pins the clock to a fixed date with MockClock, and registers Monolog's TestHandler so functional tests can assert on log records. Its only user is tests/ApplicationTestCase.php. It reached packages/guides by accident rather than by decision. It was created in packages/guides-symfony alongside ContainerFactory (1d10cbd), and that package was dissolved the next day, so the rename carried it into packages/guides (54daa48). Later commits added the Monolog handler (ba041eb) and the mocked clock (541fbf4) without anyone revisiting where it lives. The fully qualified name does not change: packages/guides/tests/unit maps to the same phpDocumentor\Guides namespace, and the root autoload-dev already covers that path, so no import or consumer is touched. Because every package marks /tests export-ignore, the class now stays out of the published phpdocumentor/guides, and with it Monolog and MockClock as production symbols. Refs phpDocumentor#1355 Signed-off-by: Sebastian Mendel <info@sebastianmendel.de> Assisted-by: claude-code:claude-fable-5 Agent-Session: https://claude.ai/code/session_0114KJz3vqq2WWfx4FUdmcss Agent-Host: 0493f0
CybotTM
force-pushed
the
chore/move-test-extension
branch
from
August 20, 2026 11:57
16a5c91 to
d8c5cc0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves
TestExtensionfrompackages/guides/src/topackages/guides/tests/unit/. Pure rename, no content change.Why
It is test infrastructure, not library code.
process()forcesParser,Compilerandphpdoc.guides.output_node_rendererpublic so tests can pull them from the container, replaces the clock withMockClockpinned to2023-01-01 12:00:00, and registers Monolog'sTestHandlerso functional tests can assert on log records. Its only user istests/ApplicationTestCase.php, from whichtests/Functional/FunctionalTest.phpandtests/Integration/IntegrationTest.phpinherit. Nopackages/*/srcreferences it.It reached this package by accident rather than by decision.
1d10cbd8created it inpackages/guides-symfony/src/DependencyInjection/next to the newContainerFactory, wiring it intoApplicationTestCasein the same commit.54daa48fdissolvedguides-symfonythe next day, and the rename carried the file intopackages/guides.ba041eb8then added the Monolog handler and541fbf4dthe mocked clock, each without revisiting where the class lives, and the "make all classes final" sweep ina7395d07treated it as ordinary library code.The effect is that
phpdocumentor/guidesships a class usingMonolog\Logger,Monolog\Handler\TestHandlerandSymfony\Component\Clock\MockClockas production symbols, none of which the package requires. That is one of the items in #1355.Why this is safe
The fully qualified name is unchanged.
packages/guides/tests/unit/maps to the samephpDocumentor\Guides\namespace assrc/, and the rootautoload-devalready lists that path, so no import, no consumer and no configuration changes. Because every package marks/tests export-ignore, the class simply stops being part of the publishedphpdocumentor/guides.The one visible change for a consumer: anyone who pulled
phpDocumentor\Guides\DependencyInjection\TestExtensionout of the published package to test their own extension would lose it. It is undocumented and appears in no guide, so this looks unintended rather than a supported entry point — worth a second opinion if you disagree.Verification
Full suite 828 tests, no failures. PHPStan and PHPCS clean.
Assisted by claude-code:claude-fable-5 — Session