Don't run the moose controller test if Moose isn't available
[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( $self, '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('View::Dump::Request');
29 }
30
31 sub jojo : Local {
32     my ( $self, $c ) = @_;
33     $c->forward('one');
34     $c->forward( $c->controller('Action::Forward'), 'three' );
35 }
36
37 sub inheritance : Local {
38     my ( $self, $c ) = @_;
39     $c->forward('/action/inheritance/a/b/default');
40     $c->forward('five');
41 }
42
43 sub global : Local {
44     my ( $self, $c ) = @_;
45     $c->forward('/global_action');
46 }
47
48 sub with_args : Local {
49     my ( $self, $c, $orig ) = @_;
50     $c->forward( 'args', [qq/new/] );
51     $c->res->body( $c->req->args->[0] );
52 }
53
54 sub 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  
60 sub to_action_object : Local {
61     my ( $self, $c ) = @_;
62     $c->forward($self->action_for('embed'), [qw/mtfnpy/]);
63 }
64
65
66 sub args : Local {
67     my ( $self, $c, $val ) = @_;
68     die "Expected argument 'new', got '$val'" unless $val eq 'new';
69     die "passed argument does not match args" unless $val eq $c->req->args->[0];
70 }
71
72 sub args_embed_relative : Local {
73     my ( $self, $c ) = @_;
74     $c->forward('embed/ok');
75 }
76
77 sub args_embed_absolute : Local {
78     my ( $self, $c ) = @_;
79     $c->forward('/action/forward/embed/ok');
80 }
81
82 sub embed : Local {
83     my ( $self, $c, $ok ) = @_;
84
85     $ok ||= 'not ok';
86     $c->res->body($ok);
87 }
88
89 sub class_forward_test_action : Local {
90     my ( $self, $c ) = @_;
91     $c->forward(qw/TestApp class_forward_test_method/);
92 }
93
94 sub forward_to_uri_check : Local {
95     my ( $self, $c ) = @_;
96     $c->forward( 'Action::ForwardTo', 'uri_check' );
97 }
98
99 1;