File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -281,4 +281,26 @@ public function testStringRepresentationWithMultipleSlashes(array $test)
281
281
{
282
282
$ this ->assertSame ($ test ['expected ' ], (string ) $ test ['uri ' ]);
283
283
}
284
+
285
+ /**
286
+ * Tests that special chars in `userInfo` must always be URL-encoded to pass RFC3986 compliant URIs where characters
287
+ * in username and password MUST NOT contain reserved characters.
288
+ * @link https://www.rfc-editor.org/rfc/rfc3986#appendix-A
289
+ * This test is taken from https://github.com/guzzle/psr7/blob/3cf1b6d4f0c820a2cf8bcaec39fc698f3443b5cf/tests/UriTest.php#L679-L688
290
+ */
291
+ public function testSpecialCharsInUserInfo (): void
292
+ {
293
+ $ uri = $ this ->createUri ('/ ' )->withUserInfo ('foo@bar.com ' , 'pass#word ' );
294
+ self ::assertSame ('foo%40bar.com:pass%23word ' , $ uri ->getUserInfo ());
295
+ }
296
+
297
+ /**
298
+ * Tests that userinfo which is already encoded is not encoded twice.
299
+ * This test is taken from https://github.com/guzzle/psr7/blob/3cf1b6d4f0c820a2cf8bcaec39fc698f3443b5cf/tests/UriTest.php#L679-L688
300
+ */
301
+ public function testAlreadyEncodedUserInfo (): void
302
+ {
303
+ $ uri = $ this ->createUri ('/ ' )->withUserInfo ('foo%40bar.com ' , 'pass%23word ' );
304
+ self ::assertSame ('foo%40bar.com:pass%23word ' , $ uri ->getUserInfo ());
305
+ }
284
306
}
You can’t perform that action at this time.
0 commit comments