Skip to content

Commit

Permalink
add reroute to fragment tests, #1156, f3-factory/fatfree-core#282
Browse files Browse the repository at this point in the history
  • Loading branch information
ikkez committed Aug 26, 2019
1 parent 0a43752 commit 94c235e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions app/router.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,24 @@ function($f3) {
$rr5=='/resize/20x20/foo/bar/sep/baz.gif',
'Rerouting to alias'
);
$f3->reroute('@hello#foo');
$rr1=$f3->get('reroute');
$f3->reroute('@hello?x=789#foo');
$rr2=$f3->get('reroute');
$f3->reroute('@complex(format=20x20,*=[foo/bar,baz.gif])#foo');
$rr3=$f3->get('reroute');
$f3->reroute('@complex(format=20x20,*=[foo/bar,baz.gif])?x=789#foo');
$rr4=$f3->get('reroute');
$f3->reroute(['complex','format=20x20,*=[foo/bar,baz.gif]',['x'=>789],'foo']);
$rr5=$f3->get('reroute');
$test->expect(
$rr1=='/#foo' &&
$rr2=='/?x=789#foo' &&
$rr3=='/resize/20x20/foo/bar/sep/baz.gif#foo' &&
$rr4=='/resize/20x20/foo/bar/sep/baz.gif?x=789#foo' &&
$rr5=='/resize/20x20/foo/bar/sep/baz.gif?x=789#foo',
'Rerouting to page fragment'
);
$f3->set('ONREROUTE',NULL);
$f3->mock('GET /');
$test->expect(
Expand Down

0 comments on commit 94c235e

Please sign in to comment.