X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FTestApp%2FController%2FAction%2FForward.pm;h=e118d73823ddda56c11e5c101fe011c4ea4a5551;hb=4e69c1c8fe7754b8e208705c734991354c12b268;hp=44d0badd83c7051aeb691f2433104815d3cd3c16;hpb=c462faf09f20b2fca60bb9c63bf30b158760aa2c;p=catagits%2FCatalyst-Runtime.git diff --git a/t/lib/TestApp/Controller/Action/Forward.pm b/t/lib/TestApp/Controller/Action/Forward.pm index 44d0bad..e118d73 100644 --- a/t/lib/TestApp/Controller/Action/Forward.pm +++ b/t/lib/TestApp/Controller/Action/Forward.pm @@ -3,7 +3,7 @@ package TestApp::Controller::Action::Forward; use strict; use base 'TestApp::Controller::Action'; -sub one : Relative { +sub one : Local { my ( $self, $c ) = @_; $c->forward('two'); } @@ -13,32 +13,81 @@ sub two : Private { $c->forward('three'); } -sub three : Relative { +sub three : Local { my ( $self, $c ) = @_; - $c->forward('four'); + $c->forward( $self, 'four' ); } sub four : Private { my ( $self, $c ) = @_; - $c->forward('five'); + $c->forward('/action/forward/five'); } -sub five : Relative { +sub five : Local { my ( $self, $c ) = @_; - $c->forward('TestApp::View::Dump::Request'); + $c->forward('View::Dump::Request'); } -sub jojo : Relative { +sub jojo : Local { my ( $self, $c ) = @_; $c->forward('one'); - $c->forward('three'); + $c->forward( $c->controller('Action::Forward'), 'three' ); } - -sub inheritance : Relative { +sub inheritance : Local { my ( $self, $c ) = @_; - $c->forward('engine/response/cookies/one'); + $c->forward('/action/inheritance/a/b/default'); $c->forward('five'); } +sub global : Local { + my ( $self, $c ) = @_; + $c->forward('/global_action'); +} + +sub with_args : Local { + my ( $self, $c, $orig ) = @_; + $c->forward( 'args', [qq/new/] ); + $c->res->body( $c->req->args->[0] ); +} + +sub with_method_and_args : Local { + my ( $self, $c, $orig ) = @_; + $c->forward( qw/TestApp::Controller::Action::Forward args/, [qq/new/] ); + $c->res->body( $c->req->args->[0] ); +} + +sub args : Local { + my ( $self, $c, $val ) = @_; + die "Expected argument 'new', got '$val'" unless $val eq 'new'; + die "passed argument does not match args" unless $val eq $c->req->args->[0]; +} + +sub args_embed_relative : Local { + my ( $self, $c ) = @_; + $c->forward('embed/ok'); +} + +sub args_embed_absolute : Local { + my ( $self, $c ) = @_; + $c->forward('/action/forward/embed/ok'); +} + +sub embed : Local { + my ( $self, $c, $ok ) = @_; + + $ok ||= 'not ok'; + $c->res->body($ok); +} + +sub class_forward_test_action : Local { + my ( $self, $c ) = @_; + $c->forward(qw/TestApp class_forward_test_method/); +} + +sub forward_to_uri_check : Local { + my ( $self, $c ) = @_; + $c->forward( 'Action::ForwardTo', 'uri_check' ); +} + 1;