From 6c5af179becd13c300eeff1aef417af3ff5dec5c Mon Sep 17 00:00:00 2001 From: Tom Janssen Date: Wed, 20 Dec 2023 15:40:22 +0100 Subject: [PATCH] [10.x] Add method to create request (#49446) * add method to create request * formatting --------- Co-authored-by: Taylor Otwell --- .../Testing/Concerns/MakesHttpRequests.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php b/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php index a2b2c8c675a9..6717b089d0b6 100644 --- a/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php +++ b/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php @@ -583,7 +583,7 @@ public function call($method, $uri, $parameters = [], $cookies = [], $files = [] ); $response = $kernel->handle( - $request = Request::createFromBase($symfonyRequest) + $request = $this->createTestRequest($symfonyRequest) ); $kernel->terminate($request, $response); @@ -710,6 +710,17 @@ protected function followRedirects($response) return $response; } + /** + * Create the request instance used for testing from the given Symfony request. + * + * @param \Symfony\Component\HttpFoundation\Request $symfonyRequest + * @return \Illuminate\Http\Request + */ + protected function createTestRequest($symfonyRequest) + { + return Request::createFromBase($symfonyRequest); + } + /** * Create the test response instance from the given response. *