docs(unit-testing): exercise a PSR-15 middleware without an instance - #123
Merged
Conversation
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>
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
|
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:
Merge ohne Fremdreview. |
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.



From a retro. I had to prove how a third-party middleware behaves in a production project I could not boot —
composer installcannot 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.mdcovering the scratch project outside the repository (so Composer config discovery cannot pick up the project's own), thepolicy.advisories.blockescape a throwaway probe needs and nothing else does, and callingprocess()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.