Skip to content

Commit c522bf6

Browse files
committed
Add test
1 parent 4cac3de commit c522bf6

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

src/ApacheModRewriteGenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ public function generateRewrite( string $from, string $to, int $type ) : string
1919

2020
if( !empty($parsedFrom['fragment']) ) {
2121
throw new UnhandledUrlException(
22-
'FROM URL fragments cannot be handled - fragments are not sent in the request to the server.'
22+
'"FROM" URI fragments cannot be handled - fragments are not sent in the request to the server.'
2323
);
2424
}
2525

2626
if( !empty($parsedTo['fragment']) ) {
2727
throw new UnhandledUrlException(
28-
'Rewriting to URLs with fragments is not supported.'
28+
'"TO" URI fragments are not supported at this time.'
2929
);
3030
}
3131

tests/tests/ApacheIntegrationTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ public function exampleProvider() : Generator {
130130
TAG
131131
,
132132
];
133+
133134
}
134135

135136
/**
@@ -202,6 +203,24 @@ public function failureProvider() : Generator {
202203
TAG
203204
, 3,
204205
];
206+
207+
yield [
208+
<<<'TAG'
209+
foo.html#funk bar.html
210+
foo.html bar.html#fresh
211+
TAG
212+
,
213+
<<<'TAG'
214+
# WARNING: Input contained 2 error(s)
215+
216+
# 301 --- foo.html#funk => bar.html
217+
# ERROR: "FROM" URI fragments cannot be handled - fragments are not sent in the request to the server.: foo.html#funk bar.html
218+
# 301 --- foo.html => bar.html#fresh
219+
# ERROR: "TO" URI fragments are not supported at this time.: foo.html bar.html#fresh
220+
221+
TAG
222+
, 2,
223+
];
205224
}
206225

207226
}

0 commit comments

Comments
 (0)