X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=trunk%2Ft%2Flib%2FTestApp%2FController%2FAction%2FForward.pm;fp=trunk%2Ft%2Flib%2FTestApp%2FController%2FAction%2FForward.pm;h=062d6a166e61ffe0457958bdc78fdadf3895d10c;hb=e28a6876ad3e11890226e5bab6df4b0725e0981e;hp=0000000000000000000000000000000000000000;hpb=21c94d83082b43028cafcfb18659090b13d832fa;p=catagits%2FCatalyst-Runtime.git diff --git a/trunk/t/lib/TestApp/Controller/Action/Forward.pm b/trunk/t/lib/TestApp/Controller/Action/Forward.pm new file mode 100644 index 0000000..062d6a1 --- /dev/null +++ b/trunk/t/lib/TestApp/Controller/Action/Forward.pm @@ -0,0 +1,98 @@ +package TestApp::Controller::Action::Forward; + +use strict; +use base 'TestApp::Controller::Action'; + +sub one : Local { + my ( $self, $c ) = @_; + $c->forward('two'); +} + +sub two : Private { + my ( $self, $c ) = @_; + $c->forward('three'); +} + +sub three : Local { + my ( $self, $c ) = @_; + $c->forward( $self, 'four' ); +} + +sub four : Private { + my ( $self, $c ) = @_; + $c->forward('/action/forward/five'); +} + +sub five : Local { + my ( $self, $c ) = @_; + $c->forward('View::Dump::Request'); +} + +sub jojo : Local { + my ( $self, $c ) = @_; + $c->forward('one'); + $c->forward( $c->controller('Action::Forward'), 'three' ); +} + +sub inheritance : Local { + my ( $self, $c ) = @_; + $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 to_action_object : Local { + my ( $self, $c ) = @_; + $c->forward($self->action_for('embed'), [qw/mtfnpy/]); +} + +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;