7 use lib "$FindBin::Bin/../../../lib";
9 use Test::More tests => 300;
10 use Catalyst::Test 'TestApp';
15 TestApp::Controller::Action::Forward->begin
16 TestApp::Controller::Action::Forward->one
17 TestApp::Controller::Action::Forward->two
18 TestApp::Controller::Action::Forward->three
19 TestApp::Controller::Action::Forward->four
20 TestApp::Controller::Action::Forward->five
21 TestApp::View::Dump::Request->process
24 my $expected = join( ", ", @expected );
26 # Test forward to global private action
27 ok( my $response = request('http://localhost/action/forward/global'),
29 ok( $response->is_success, 'Response Successful 2xx' );
30 is( $response->content_type, 'text/plain', 'Response Content-Type' );
31 is( $response->header('X-Catalyst-Action'),
32 'action/forward/global', 'Main Class Action' );
34 # Test forward to chain of actions.
35 ok( $response = request('http://localhost/action/forward/one'),
37 ok( $response->is_success, 'Response Successful 2xx' );
38 is( $response->content_type, 'text/plain', 'Response Content-Type' );
39 is( $response->header('X-Catalyst-Action'),
40 'action/forward/one', 'Test Action' );
42 $response->header('X-Test-Class'),
43 'TestApp::Controller::Action::Forward',
46 is( $response->header('X-Catalyst-Executed'),
47 $expected, 'Executed actions' );
50 qr/^bless\( .* 'Catalyst::Request' \)$/s,
51 'Content is a serialized Catalyst::Request'
57 TestApp::Controller::Action::Forward->begin
58 TestApp::Controller::Action::Forward->jojo
59 TestApp::Controller::Action::Forward->one
60 TestApp::Controller::Action::Forward->two
61 TestApp::Controller::Action::Forward->three
62 TestApp::Controller::Action::Forward->four
63 TestApp::Controller::Action::Forward->five
64 TestApp::View::Dump::Request->process
65 TestApp::Controller::Action::Forward->three
66 TestApp::Controller::Action::Forward->four
67 TestApp::Controller::Action::Forward->five
68 TestApp::View::Dump::Request->process
71 my $expected = join( ", ", @expected );
73 ok( my $response = request('http://localhost/action/forward/jojo'),
75 ok( $response->is_success, 'Response Successful 2xx' );
76 is( $response->content_type, 'text/plain', 'Response Content-Type' );
77 is( $response->header('X-Catalyst-Action'),
78 'action/forward/jojo', 'Test Action' );
80 $response->header('X-Test-Class'),
81 'TestApp::Controller::Action::Forward',
84 is( $response->header('X-Catalyst-Executed'),
85 $expected, 'Executed actions' );
88 qr/^bless\( .* 'Catalyst::Request' \)$/s,
89 'Content is a serialized Catalyst::Request'
96 request('http://localhost/action/forward/with_args/old'),
99 ok( $response->is_success, 'Response Successful 2xx' );
100 is( $response->content, 'old' );
105 my $response = request(
106 'http://localhost/action/forward/with_method_and_args/old'),
107 'Request with args and method'
109 ok( $response->is_success, 'Response Successful 2xx' );
110 is( $response->content, 'old' );
113 # test forward with embedded args
117 request('http://localhost/action/forward/args_embed_relative'),
120 ok( $response->is_success, 'Response Successful 2xx' );
121 is( $response->content, 'ok' );
127 request('http://localhost/action/forward/args_embed_absolute'),
130 ok( $response->is_success, 'Response Successful 2xx' );
131 is( $response->content, 'ok' );