[13.x] Add query and queryJson HTTP testing helpers#60662
Open
shanerbaner82 wants to merge 1 commit into
Open
Conversation
Adds query() and queryJson() methods to MakesHttpRequests so applications can test routes responding to the HTTP QUERY method, mirroring the existing helpers for the other HTTP verbs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Concept first mentioned by issue #60564, in case we want extra discussion. |
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.
With the HTTP
QUERYmethod gaining first-class routing support (#60655) — andRoute::match(['QUERY'], ...)already working today — there is currently no fluent way to test such routes:MakesHttpRequestsoffers helpers for every other verb but not QUERY.This PR adds
$this->query($uri, $data, $headers)and$this->queryJson(...), mirroring the existingdelete()/deleteJson()helpers since QUERY is a safe method that carries its query in the request body:Symfony HttpFoundation ≥ 7.4 (Laravel 13's minimum) natively supports QUERY in
Request::create(), placing test data in the request body just like POST/PUT/DELETE — the tests assert this explicitly ($request->post('filter')is set,$request->query('filter')is not).Fully backward compatible — purely additive, no contracts changed. Tests cover both helpers end-to-end through the router.
🤖 Generated with Claude Code