Skip to content

docs(unit-testing): exercise a PSR-15 middleware without an instance - #123

Merged
CybotTM merged 1 commit into
mainfrom
docs/verify-middleware-without-instance
Aug 12, 2026
Merged

docs(unit-testing): exercise a PSR-15 middleware without an instance#123
CybotTM merged 1 commit into
mainfrom
docs/verify-middleware-without-instance

Conversation

@CybotTM

@CybotTM CybotTM commented Aug 12, 2026

Copy link
Copy Markdown
Member

From a retro. I had to prove how a third-party middleware behaves in a production project I could not boot — composer install cannot authenticate against the paid georgringer add-ons there, and the database lives elsewhere. The tempting move is to read the class and declare it verified; the honest one is that a PSR-15 middleware needs only a request, a handler and the attributes it reads.

Adds a section to unit-testing.md covering the scratch project outside the repository (so Composer config discovery cannot pick up the project's own), the policy.advisories.block escape a throwaway probe needs and nothing else does, and calling process() against the repository's real site configuration rather than a fixture — a hand-built one silently answers a different question.

It also names the two limits, because the value of the technique depends on reporting them: whatever you strip to make construction work is untested, and registration order is not something the probe can show. In the case that prompted this, seven cases came back correct and one row in the table was only meaningful once I said which claim came from the probe and which from the middleware registration.

Bounded: one new section in references/unit-testing.md, inserted before "Test Patterns for TYPO3 Extensions". No existing text changed, no test runner or CI config touched.

When a project cannot be booted -- database elsewhere, composer install unable to
authenticate against a paid package -- the fallback is usually to reason about
the middleware and call it verified. A PSR-15 middleware needs a request, a
handler and the attributes it reads, none of which require a TYPO3 instance.

Documents a scratch project outside the repository (so its config cannot pick up
the project's own), the policy.advisories.block escape that a throwaway probe
needs and nothing else does, and calling process() against the repository's real
site configuration rather than a hand-built fixture. Names the two limits worth
reporting instead of hiding: whatever was stripped is untested, and middleware
ordering is not shown by the probe.

Signed-off-by: Sebastian Mendel <github@sebastianmendel.de>
Copilot AI lite review requested due to automatic review settings August 12, 2026 15:03
@github-actions github-actions Bot added documentation Improvements or additions to documentation skill labels Aug 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@CybotTM

CybotTM commented Aug 12, 2026

Copy link
Copy Markdown
Member Author

Copilot war auf diesem Head zweimal nicht verfügbar (Kontingent), die COMMENTED-Zeilen tragen einen Fehler im Body statt eines Reviews. Selbst gegengelesen; der Abschnitt beschreibt kein Gedankenexperiment, sondern genau den Ablauf, mit dem ich heute eine Middleware ohne Instanz belegt habe:

  • policy.advisories.block: false ist nicht kosmetisch — ohne den Schalter verweigert Composer jede TYPO3-Version mit offenem Advisory, die Installation im Scratch-Projekt bricht ab. Beides gemessen.
  • new PageArguments(13, '0', []) passt zur Signatur (int $pageId, string $pageType, array $routeArguments, …) in 12.4.
  • unset($config['baseVariants']) ist nötig, weil Site::__construct die Varianten über die ExpressionLanguage auflöst und dafür den DI-Container braucht — ohne das Entfernen endet der Aufruf in einem ArgumentCountError.

Merge ohne Fremdreview.

@CybotTM
CybotTM merged commit 9e92876 into main Aug 12, 2026
23 of 25 checks passed
@CybotTM
CybotTM deleted the docs/verify-middleware-without-instance branch August 12, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation skill

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants