Allow forward with arguments.
[catagits/Catalyst-Runtime.git] / t / lib / TestApp / Controller / Action / Forward.pm
CommitLineData
dd4e6fd2 1package TestApp::Controller::Action::Forward;
2
3use strict;
4use base 'TestApp::Controller::Action';
5
a1dad9c1 6sub one : Local {
dd4e6fd2 7 my ( $self, $c ) = @_;
8 $c->forward('two');
9}
10
11sub two : Private {
12 my ( $self, $c ) = @_;
13 $c->forward('three');
14}
15
a1dad9c1 16sub three : Local {
dd4e6fd2 17 my ( $self, $c ) = @_;
18 $c->forward('four');
19}
20
21sub four : Private {
22 my ( $self, $c ) = @_;
7eb331e7 23 $c->forward('/action/forward/five');
dd4e6fd2 24}
25
a1dad9c1 26sub five : Local {
dd4e6fd2 27 my ( $self, $c ) = @_;
28 $c->forward('TestApp::View::Dump::Request');
29}
30
7eb331e7 31
a1dad9c1 32sub jojo : Local {
dd4e6fd2 33 my ( $self, $c ) = @_;
34 $c->forward('one');
35 $c->forward('three');
36}
37
c462faf0 38
a1dad9c1 39sub inheritance : Local {
c462faf0 40 my ( $self, $c ) = @_;
5b387dfc 41 $c->forward('/action/inheritance/a/b/default');
c462faf0 42 $c->forward('five');
43}
44
a1dad9c1 45sub global : Local {
e5d7f18c 46 my ( $self, $c ) = @_;
a1dad9c1 47 $c->forward( '/global_action' );
e5d7f18c 48}
49
a1dad9c1 50sub with_args : Local {
51 my ( $self, $c, $orig ) = @_;
52 $c->forward( 'args',[qq/new/] );
53 $c->res->body( $c->req->args->[0] );
54}
55
56sub with_method_and_args : Local {
57 my ( $self, $c, $orig ) = @_;
58 $c->forward( qw/TestApp::Controller::Action::Forward args/, [qq/new/] );
59 $c->res->body( $c->req->args->[0] );
60}
61
62sub args : Local {
63 my ( $self, $c, $val ) = @_;
64 die "Expected argument 'new', got '$val'" unless $val eq 'new';
65 die "passed argument does not match args" unless $val eq $c->req->args->[0];
66}
e5d7f18c 67
dd4e6fd2 681;