7 use lib "$FindBin::Bin/../../../lib";
9 use Test::More tests => 30;
10 use Catalyst::Test 'TestApp';
14 TestApp::Controller::Action::Forward->begin
15 TestApp::Controller::Action::Forward->one
16 TestApp::Controller::Action::Forward->two
17 TestApp::Controller::Action::Forward->three
18 TestApp::Controller::Action::Forward->four
19 TestApp::Controller::Action::Forward->five
20 TestApp::View::Dump::Request->process
23 my $expected = join( ", ", @expected );
25 # Test forward to global private action
26 ok( my $response = request('http://localhost/action/forward/global'),
28 ok( $response->is_success, 'Response Successful 2xx' );
29 is( $response->content_type, 'text/plain', 'Response Content-Type' );
30 is( $response->header('X-Catalyst-Action'),
31 'action/forward/global', 'Main Class Action' );
33 # Test forward to chain of actions.
34 ok( $response = request('http://localhost/action/forward/one'), 'Request' );
35 ok( $response->is_success, 'Response Successful 2xx' );
36 is( $response->content_type, 'text/plain', 'Response Content-Type' );
37 is( $response->header('X-Catalyst-Action'),
38 'action/forward/one', 'Test Action' );
40 $response->header('X-Test-Class'),
41 'TestApp::Controller::Action::Forward',
44 is( $response->header('X-Catalyst-Executed'),
45 $expected, 'Executed actions' );
48 qr/^bless\( .* 'Catalyst::Request' \)$/s,
49 'Content is a serialized Catalyst::Request'
55 TestApp::Controller::Action::Forward->begin
56 TestApp::Controller::Action::Forward->jojo
57 TestApp::Controller::Action::Forward->one
58 TestApp::Controller::Action::Forward->two
59 TestApp::Controller::Action::Forward->three
60 TestApp::Controller::Action::Forward->four
61 TestApp::Controller::Action::Forward->five
62 TestApp::View::Dump::Request->process
63 TestApp::Controller::Action::Forward->three
64 TestApp::Controller::Action::Forward->four
65 TestApp::Controller::Action::Forward->five
66 TestApp::View::Dump::Request->process
69 my $expected = join( ", ", @expected );
71 ok( my $response = request('http://localhost/action/forward/jojo'),
73 ok( $response->is_success, 'Response Successful 2xx' );
74 is( $response->content_type, 'text/plain', 'Response Content-Type' );
75 is( $response->header('X-Catalyst-Action'),
76 'action/forward/jojo', 'Test Action' );
78 $response->header('X-Test-Class'),
79 'TestApp::Controller::Action::Forward',
82 is( $response->header('X-Catalyst-Executed'),
83 $expected, 'Executed actions' );
86 qr/^bless\( .* 'Catalyst::Request' \)$/s,
87 'Content is a serialized Catalyst::Request'
93 my $response = request('http://localhost/action/forward/with_args/old'),
96 ok( $response->is_success, 'Response Successful 2xx' );
97 is( $response->content, 'old' );
103 request('http://localhost/action/forward/with_method_and_args/old'),
104 'Request with args and method'
106 ok( $response->is_success, 'Response Successful 2xx' );
107 is( $response->content, 'old' );
110 # test forward with embedded args
114 request('http://localhost/action/forward/args_embed_relative'),
117 ok( $response->is_success, 'Response Successful 2xx' );
118 is( $response->content, 'ok' );
124 request('http://localhost/action/forward/args_embed_absolute'),
127 ok( $response->is_success, 'Response Successful 2xx' );
128 is( $response->content, 'ok' );