[13.x] Add `query` and `queryJson` HTTP testing helpers

Merged
SH
3mo ago
+76-0

With the HTTP QUERY method gaining first-class routing support (#60655) — and Route::match(['QUERY'], ...) already working today — there is currently no fluent way to test such routes: MakesHttpRequests offers helpers for every other verb but not QUERY.

This PR adds $this->query($uri, $data, $headers) and $this->queryJson(...), mirroring the existing delete()/deleteJson() helpers since QUERY is a safe method that carries its query in the request body:

Route::match(['QUERY'], '/search', fn () => request()->input('filter'));

$this->queryJson('/search', ['filter' => 'active'])->assertOk();

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