@@ -26,10 +26,26 @@ function () {}
2626 )->wait ();
2727 }
2828
29+ public function provideRedirections (): array
30+ {
31+ return [
32+ 'no path on target ' => ["https://example.com/path?query=value " , "https://example.com?query=value " , "https://example.com?query=value " ],
33+ 'root path on target ' => ["https://example.com/path?query=value " , "https://example.com/?query=value " , "https://example.com/?query=value " ],
34+ 'redirect to query ' => ["https://example.com " , "https://example.com?query=value " , "https://example.com?query=value " ],
35+ 'redirect to different domain without port ' => ["https://example.com:8000 " , "https://foo.com?query=value " , "https://foo.com?query=value " ],
36+ 'network-path redirect, preserve scheme ' => ["https://example.com:8000 " , "//foo.com/path?query=value " , "https://foo.com/path?query=value " ],
37+ 'absolute-path redirect, preserve host ' => ["https://example.com:8000 " , "/path?query=value " , "https://example.com:8000/path?query=value " ],
38+ 'relative-path redirect, append ' => ["https://example.com:8000/path/ " , "sub/path?query=value " , "https://example.com:8000/path/sub/path?query=value " ],
39+ 'relative-path on non-folder ' => ["https://example.com:8000/path/foo " , "sub/path?query=value " , "https://example.com:8000/path/sub/path?query=value " ],
40+ 'relative-path moving up ' => ["https://example.com:8000/path/ " , "../other?query=value " , "https://example.com:8000/other?query=value " ],
41+ 'relative-path with ./ ' => ["https://example.com:8000/path/ " , "./other?query=value " , "https://example.com:8000/path/other?query=value " ],
42+ 'relative-path with // ' => ["https://example.com:8000/path/ " , "other//sub?query=value " , "https://example.com:8000/path/other//sub?query=value " ],
43+ 'relative-path redirect with only query ' => ["https://example.com:8000/path " , "?query=value " , "https://example.com:8000/path?query=value " ],
44+ ];
45+ }
46+
2947 /**
30- * @testWith ["https://example.com/path?query=value", "https://example.com?query=value", "https://example.com?query=value"]
31- * ["https://example.com/path?query=value", "https://example.com/?query=value", "https://example.com/?query=value"]
32- * ["https://example.com", "https://example.com?query=value", "https://example.com?query=value"]
48+ * @dataProvider provideRedirections
3349 */
3450 public function testTargetUriMappingFromLocationHeader (string $ originalUri , string $ locationUri , string $ targetUri ): void
3551 {
0 commit comments