r12983@zaphod: kd | 2008-04-28 18:10:27 +1000
[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 ) = @_;
86d993ab 18 $c->forward( $self, 'four' );
dd4e6fd2 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 ) = @_;
d6e0d7e6 28 $c->forward('View::Dump::Request');
dd4e6fd2 29}
30
a1dad9c1 31sub jojo : Local {
dd4e6fd2 32 my ( $self, $c ) = @_;
33 $c->forward('one');
86d993ab 34 $c->forward( $c->controller('Action::Forward'), 'three' );
dd4e6fd2 35}
36
a1dad9c1 37sub inheritance : Local {
c462faf0 38 my ( $self, $c ) = @_;
5b387dfc 39 $c->forward('/action/inheritance/a/b/default');
c462faf0 40 $c->forward('five');
41}
42
a1dad9c1 43sub global : Local {
e5d7f18c 44 my ( $self, $c ) = @_;
fbcc39ad 45 $c->forward('/global_action');
e5d7f18c 46}
47
a1dad9c1 48sub with_args : Local {
49 my ( $self, $c, $orig ) = @_;
fbcc39ad 50 $c->forward( 'args', [qq/new/] );
a1dad9c1 51 $c->res->body( $c->req->args->[0] );
52}
53
54sub with_method_and_args : Local {
55 my ( $self, $c, $orig ) = @_;
56 $c->forward( qw/TestApp::Controller::Action::Forward args/, [qq/new/] );
57 $c->res->body( $c->req->args->[0] );
58}
59
60sub args : Local {
61 my ( $self, $c, $val ) = @_;
62 die "Expected argument 'new', got '$val'" unless $val eq 'new';
63 die "passed argument does not match args" unless $val eq $c->req->args->[0];
64}
e5d7f18c 65
ab96c27a 66sub args_embed_relative : Local {
67 my ( $self, $c ) = @_;
86d993ab 68 $c->forward('embed/ok');
ab96c27a 69}
70
71sub args_embed_absolute : Local {
72 my ( $self, $c ) = @_;
86d993ab 73 $c->forward('/action/forward/embed/ok');
ab96c27a 74}
75
76sub embed : Local {
77 my ( $self, $c, $ok ) = @_;
86d993ab 78
ab96c27a 79 $ok ||= 'not ok';
86d993ab 80 $c->res->body($ok);
81}
82
83sub class_forward_test_action : Local {
84 my ( $self, $c ) = @_;
85 $c->forward(qw/TestApp class_forward_test_method/);
ab96c27a 86}
87
2f381252 88sub forward_to_uri_check : Local {
89 my ( $self, $c ) = @_;
90 $c->forward( 'Action::ForwardTo', 'uri_check' );
91}
92
dd4e6fd2 931;