7 use lib "$FindBin::Bin/../../../lib";
11 BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; }
13 use Test::More tests => 30*$iters;
14 use Catalyst::Test 'TestApp';
16 if ( $ENV{CAT_BENCHMARK} ) {
18 Benchmark::timethis( $iters, \&run_tests );
29 TestApp::Controller::Action::Forward->begin
30 TestApp::Controller::Action::Forward->one
31 TestApp::Controller::Action::Forward->two
32 TestApp::Controller::Action::Forward->three
33 TestApp::Controller::Action::Forward->four
34 TestApp::Controller::Action::Forward->five
35 TestApp::View::Dump::Request->process
38 my $expected = join( ", ", @expected );
40 # Test forward to global private action
41 ok( my $response = request('http://localhost/action/forward/global'),
43 ok( $response->is_success, 'Response Successful 2xx' );
44 is( $response->content_type, 'text/plain', 'Response Content-Type' );
45 is( $response->header('X-Catalyst-Action'),
46 'action/forward/global', 'Main Class Action' );
48 # Test forward to chain of actions.
49 ok( $response = request('http://localhost/action/forward/one'),
51 ok( $response->is_success, 'Response Successful 2xx' );
52 is( $response->content_type, 'text/plain', 'Response Content-Type' );
53 is( $response->header('X-Catalyst-Action'),
54 'action/forward/one', 'Test Action' );
56 $response->header('X-Test-Class'),
57 'TestApp::Controller::Action::Forward',
60 is( $response->header('X-Catalyst-Executed'),
61 $expected, 'Executed actions' );
64 qr/^bless\( .* 'Catalyst::Request' \)$/s,
65 'Content is a serialized Catalyst::Request'
71 TestApp::Controller::Action::Forward->begin
72 TestApp::Controller::Action::Forward->jojo
73 TestApp::Controller::Action::Forward->one
74 TestApp::Controller::Action::Forward->two
75 TestApp::Controller::Action::Forward->three
76 TestApp::Controller::Action::Forward->four
77 TestApp::Controller::Action::Forward->five
78 TestApp::View::Dump::Request->process
79 TestApp::Controller::Action::Forward->three
80 TestApp::Controller::Action::Forward->four
81 TestApp::Controller::Action::Forward->five
82 TestApp::View::Dump::Request->process
85 my $expected = join( ", ", @expected );
87 ok( my $response = request('http://localhost/action/forward/jojo'),
89 ok( $response->is_success, 'Response Successful 2xx' );
90 is( $response->content_type, 'text/plain', 'Response Content-Type' );
91 is( $response->header('X-Catalyst-Action'),
92 'action/forward/jojo', 'Test Action' );
94 $response->header('X-Test-Class'),
95 'TestApp::Controller::Action::Forward',
98 is( $response->header('X-Catalyst-Executed'),
99 $expected, 'Executed actions' );
102 qr/^bless\( .* 'Catalyst::Request' \)$/s,
103 'Content is a serialized Catalyst::Request'
110 request('http://localhost/action/forward/with_args/old'),
113 ok( $response->is_success, 'Response Successful 2xx' );
114 is( $response->content, 'old' );
119 my $response = request(
120 'http://localhost/action/forward/with_method_and_args/old'),
121 'Request with args and method'
123 ok( $response->is_success, 'Response Successful 2xx' );
124 is( $response->content, 'old' );
127 # test forward with embedded args
131 request('http://localhost/action/forward/args_embed_relative'),
134 ok( $response->is_success, 'Response Successful 2xx' );
135 is( $response->content, 'ok' );
141 request('http://localhost/action/forward/args_embed_absolute'),
144 ok( $response->is_success, 'Response Successful 2xx' );
145 is( $response->content, 'ok' );