X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FTestApp%2FController%2FEngine%2FRequest%2FURI.pm;h=03cf758b72159071314e7bbe4d797c3c9e73864e;hb=d0f0fcf6ec9f6445e3e241b3edcd3920886a02cf;hp=cb86f3046802dafe50c508be536f97860cf44207;hpb=66741f94ac93b7ba0989db3556d0e3fe36c1be87;p=catagits%2FCatalyst-Runtime.git diff --git a/t/lib/TestApp/Controller/Engine/Request/URI.pm b/t/lib/TestApp/Controller/Engine/Request/URI.pm index cb86f30..03cf758 100644 --- a/t/lib/TestApp/Controller/Engine/Request/URI.pm +++ b/t/lib/TestApp/Controller/Engine/Request/URI.pm @@ -28,4 +28,53 @@ sub change_base : Local { $c->forward('TestApp::View::Dump::Request'); } +sub uri_with : Local { + my ( $self, $c ) = @_; + + # change the current uri + my $uri = $c->req->uri_with( { b => 1 } ); + my %query = $uri->query_form; + + $c->res->header( 'X-Catalyst-Param-a' => $query{ a } ); + $c->res->header( 'X-Catalyst-Param-b' => $query{ b } ); + + $c->forward('TestApp::View::Dump::Request'); +} + +sub uri_with_object : Local { + my ( $self, $c ) = @_; + + my $uri = $c->req->uri_with( { a => $c->req->base } ); + my %query = $uri->query_form; + + $c->res->header( 'X-Catalyst-Param-a' => $query{ a } ); + + $c->forward('TestApp::View::Dump::Request'); +} + +sub uri_with_utf8 : Local { + my ( $self, $c ) = @_; + + # change the current uri + my $uri = $c->req->uri_with( { unicode => "\x{2620}" } ); + + $c->res->header( 'X-Catalyst-uri-with' => "$uri" ); + + $c->forward('TestApp::View::Dump::Request'); +} + +sub uri_with_undef : Local { + my ( $self, $c ) = @_; + + my $warnings = 0; + local $SIG{__WARN__} = sub { $warnings++ }; + + # change the current uri + my $uri = $c->req->uri_with( { foo => undef } ); + + $c->res->header( 'X-Catalyst-warnings' => $warnings ); + + $c->forward('TestApp::View::Dump::Request'); +} + 1;