4fdf5eada4b3312cb0ff27e34350efe5c16e8654
[catagits/Catalyst-Runtime.git] / t / lib / TestApp / Controller / Action / Forward.pm
1 package TestApp::Controller::Action::Forward;
2
3 use strict;
4 use base 'TestApp::Controller::Action';
5
6 sub one : Local {
7     my ( $self, $c ) = @_;
8     $c->forward('two');
9 }
10
11 sub two : Private {
12     my ( $self, $c ) = @_;
13     $c->forward('three');
14 }
15
16 sub three : Local {
17     my ( $self, $c ) = @_;
18     $c->forward('four');
19 }
20
21 sub four : Private {
22     my ( $self, $c ) = @_;
23     $c->forward('/action/forward/five');
24 }
25
26 sub five : Local {
27     my ( $self, $c ) = @_;
28     $c->forward('TestApp::View::Dump::Request');
29 }
30
31
32 sub jojo : Local {
33     my ( $self, $c ) = @_;
34     $c->forward('one');
35     $c->forward('three');
36 }
37
38
39 sub inheritance : Local {
40     my ( $self, $c ) = @_;
41     $c->forward('/action/inheritance/a/b/default');
42     $c->forward('five');
43 }
44
45 sub global : Local {
46     my ( $self, $c ) = @_;
47     $c->forward( '/global_action' );
48 }
49
50 sub with_args : Local {
51     my ( $self, $c, $orig ) = @_;
52     $c->forward( 'args',[qq/new/] );
53     $c->res->body( $c->req->args->[0] );
54 }
55
56 sub 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
62 sub 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 }
67
68 1;