X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Faggregate%2Flive_component_controller_action_chained.t;h=53dca926fcca82efbf0a3f56f4549bd788f15c3b;hb=5ab21903f27011f38ec3e32ef2e649065e7adc1e;hp=615289c1198893ab04ca54de7cbe2a58e92c7ec2;hpb=06f97d3fd16d44ba720f8f064220cf73aa081ad3;p=catagits%2FCatalyst-Runtime.git diff --git a/t/aggregate/live_component_controller_action_chained.t b/t/aggregate/live_component_controller_action_chained.t index 615289c..53dca92 100644 --- a/t/aggregate/live_component_controller_action_chained.t +++ b/t/aggregate/live_component_controller_action_chained.t @@ -10,7 +10,7 @@ our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; } -use Test::More tests => 148*$iters; +use Test::More; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { @@ -815,7 +815,7 @@ sub run_tests { my @expected = qw[ TestApp::Controller::Action::Chained::Root->rootsub TestApp::Controller::Action::Chained::Root->endpointsub - TestApp->end + TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); @@ -1018,5 +1018,31 @@ sub run_tests { 'request with URI-encoded arg' ); like( $content, qr{foo/bar;\z}, 'args decoded' ); } + + # Test round tripping, specifically the / character %2F in uri_for: + # not being able to feed it back action + captureargs and args into uri for + # and result in the original request uri is a major piece of suck ;) + foreach my $thing ( + ['foo', 'bar'], + ['foo%2Fbar', 'baz'], + ['foo', 'bar%2Fbaz'], + ['foo%2Fbar', 'baz%2Fquux'], + ['foo%2Fbar', 'baz%2Fquux', { foo => 'bar', 'baz' => 'quux%2Ffrood'}], + ['foo%2Fbar', 'baz%2Fquux', { foo => 'bar', 'baz%2Ffnoo' => 'quux%2Ffrood'}], + ) { + my $path = '/chained/roundtrip_urifor/' . + $thing->[0] . '/' . $thing->[1]; + $path .= '?' . join('&', + map { $_ .'='. $thing->[2]->{$_}} + sort keys %{$thing->[2]}) if $thing->[2]; + ok( my $content = + get('http://localhost/' . $path), + 'request ' . $path . ' ok'); + # Just check that the path matches, as who the hell knows or cares + # where the app is based (live tests etc) + ok( index($content, $path) > 1, 'uri can round trip through uri_for' ); + } } +done_testing; +