X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flive_component_controller_action_chained.t;h=d2bf10753f70c54561dc5d9252aaaf8ee2cc900f;hb=d64fb878931982133b1ddfdbd2804a30082ec87e;hp=9cb6bf4c13bfb6d7bf74878fdf16e1f6c0fad552;hpb=be7ce1dcadffa68bbd99efb2366cfe1712dd678f;p=catagits%2FCatalyst-Runtime.git diff --git a/t/live_component_controller_action_chained.t b/t/live_component_controller_action_chained.t index 9cb6bf4..d2bf107 100644 --- a/t/live_component_controller_action_chained.t +++ b/t/live_component_controller_action_chained.t @@ -10,7 +10,7 @@ our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; } -use Test::More tests => 127*$iters; +use Test::More tests => 136*$iters; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { @@ -528,6 +528,69 @@ sub run_tests { } # + # Test if :Chained('../act') is working + # + { + local $TODO = "To Be Coded"; + my @expected = qw[ + TestApp::Controller::Action::Chained->begin + TestApp::Controller::Action::Chained->rootdef + TestApp::Controller::Action::Chained::ParentChain->chained_rel + TestApp::Controller::Action::Chained->end + ]; + + my $expected = join( ", ", @expected ); + + ok( my $response = request('http://localhost/chained/rootdef/1/chained_rel/3/2'), + ":Chained('../action') chains to correct action" ); + is( $response->header('X-Catalyst-Executed'), + $expected, 'Executed actions' ); + is( $response->content, '1; 3, 2', 'Content OK' ); + } + + # + # Test if :ChainedParent is working + # + { + local $TODO = "To Be Coded"; + my @expected = qw[ + TestApp::Controller::Action::Chained->begin + TestApp::Controller::Action::Chained->loose + TestApp::Controller::Action::Chained::ParentChain->loose + TestApp::Controller::Action::Chained->end + ]; + + my $expected = join( ", ", @expected ); + + ok( my $response = request('http://localhost/chained/loose/4/loose/a/b'), + ":Chained('../action') chains to correct action" ); + is( $response->header('X-Catalyst-Executed'), + $expected, 'Executed actions' ); + is( $response->content, '4; a, b', 'Content OK' ); + } + + # + # Test if :Chained('../name/act') is working + # + { + local $TODO = "To Be Coded"; + my @expected = qw[ + TestApp::Controller::Action::Chained->begin + TestApp::Controller::Action::Chained::Bar->cross1 + TestApp::Controller::Action::Chained::ParentChain->up_down + TestApp::Controller::Action::Chained->end + ]; + + my $expected = join( ", ", @expected ); + + ok( my $response = request('http://localhost/chained/cross/4/up_down/5'), + ":Chained('../action') chains to correct action" ); + is( $response->header('X-Catalyst-Executed'), + $expected, 'Executed actions' ); + is( $response->content, '4; 5', 'Content OK' ); + } + + # # Test behaviour of auto actions returning '1' for the chain. # {