Skip to content
This repository was archived by the owner on Jun 4, 2025. It is now read-only.

Commit 6a4e2a9

Browse files
committed
Add test for setRequestUri() with no query string, but question mark
1 parent 76b2840 commit 6a4e2a9

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

tests/RequestTest.php

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,15 +1084,31 @@ public function testSetCookiesShouldRemoveCookieHeader()
10841084
$this->assertSame('', $result->getHeader('Cookie'));
10851085
}
10861086

1087-
public function testSetRequestUriWithNoQueryString()
1087+
/**
1088+
* @dataProvider providerSetRequestUriWithNoQueryString
1089+
*
1090+
* @param string $requestUri
1091+
*/
1092+
public function testSetRequestUriWithNoQueryString(string $requestUri)
10881093
{
10891094
$request = new Request();
1090-
$result = $request->setRequestUri('http://localhost/');
1095+
$result = $request->setRequestUri($requestUri);
10911096
$this->assertInstanceOf(Request::class, $result);
1092-
$this->assertContains('http://localhost/', $result->getRequestUri());
1097+
$this->assertSame($requestUri, $result->getRequestUri());
10931098
$this->assertSame([], $result->getQuery());
10941099
$this->assertSame('', $result->getQueryString());
1095-
$this->assertSame('http://localhost/', $result->getPath());
1100+
$this->assertSame(rtrim($requestUri, '?'), $result->getPath());
1101+
}
1102+
1103+
/**
1104+
* @return array
1105+
*/
1106+
public function providerSetRequestUriWithNoQueryString()
1107+
{
1108+
return [
1109+
['/foo'],
1110+
['/foo/bar?']
1111+
];
10961112
}
10971113

10981114
/**

0 commit comments

Comments
 (0)