Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
donatj committed Oct 31, 2019
1 parent 4cac3de commit c522bf6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ApacheModRewriteGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ public function generateRewrite( string $from, string $to, int $type ) : string

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

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

Expand Down
19 changes: 19 additions & 0 deletions tests/tests/ApacheIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ public function exampleProvider() : Generator {
TAG
,
];

}

/**
Expand Down Expand Up @@ -202,6 +203,24 @@ public function failureProvider() : Generator {
TAG
, 3,
];

yield [
<<<'TAG'
foo.html#funk bar.html
foo.html bar.html#fresh
TAG
,
<<<'TAG'
# WARNING: Input contained 2 error(s)
# 301 --- foo.html#funk => bar.html
# ERROR: "FROM" URI fragments cannot be handled - fragments are not sent in the request to the server.: foo.html#funk bar.html
# 301 --- foo.html => bar.html#fresh
# ERROR: "TO" URI fragments are not supported at this time.: foo.html bar.html#fresh

TAG
, 2,
];
}

}

0 comments on commit c522bf6

Please sign in to comment.