Skip to content

Commit b2e6525

Browse files
committed
Fix testing
1 parent 80145ca commit b2e6525

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

system/Test/FeatureTestTrait.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,12 +316,15 @@ public function options(string $path, array $params = null)
316316
*/
317317
protected function setupRequest(string $method, string $path = null): IncomingRequest
318318
{
319-
$config = config(App::class);
320-
$uri = new URI(rtrim($config->baseURL, '/') . '/' . trim($path, '/ '));
319+
$path = URI::removeDotSegments($path);
320+
$config = config(App::class);
321+
$request = new IncomingRequest($config, new URI(), null, new UserAgent());
321322

322-
$request = new IncomingRequest($config, clone($uri), null, new UserAgent());
323-
$request->uri = $uri;
323+
// $path may have a query in it
324+
$parts = explode('?', $path);
325+
$_SERVER['QUERY_STRING'] = $parts[1] ?? '';
324326

327+
$request->setPath($parts[0]);
325328
$request->setMethod($method);
326329
$request->setProtocolVersion('1.1');
327330

0 commit comments

Comments
 (0)