7 use lib "$FindBin::Bin/../../../lib";
9 use Test::More tests => 180;
10 use Catalyst::Test 'TestApp';
12 if ( $ENV{CAT_BENCHMARK} ) {
14 Benchmark::timethis( -10, \&run_tests );
17 # 11 wallclock secs (10.14 usr + 0.20 sys = 10.34 CPU) @ 15.18/s (n=157)
18 # old dispatcher (r1486):
19 # 11 wallclock secs (10.34 usr + 0.20 sys = 10.54 CPU) @ 13.76/s (n=145)
28 # test auto + local method
31 TestApp::Controller::Action::Auto->begin
32 TestApp::Controller::Action::Auto->auto
33 TestApp::Controller::Action::Auto->one
36 my $expected = join( ", ", @expected );
38 ok( my $response = request('http://localhost/action/auto/one'), 'auto + local' );
39 is( $response->header('X-Catalyst-Executed'),
40 $expected, 'Executed actions' );
41 is( $response->content, 'one', 'Content OK' );
47 TestApp::Controller::Action::Auto->begin
48 TestApp::Controller::Action::Auto->auto
49 TestApp::Controller::Action::Auto->default
52 my $expected = join( ", ", @expected );
54 ok( my $response = request('http://localhost/action/auto/anything'), 'auto + default' );
55 is( $response->header('X-Catalyst-Executed'),
56 $expected, 'Executed actions' );
57 is( $response->content, 'default', 'Content OK' );
60 # test auto + auto + local
63 TestApp::Controller::Action::Auto::Deep->begin
64 TestApp::Controller::Action::Auto->auto
65 TestApp::Controller::Action::Auto::Deep->auto
66 TestApp::Controller::Action::Auto::Deep->one
69 my $expected = join( ", ", @expected );
71 ok( my $response = request('http://localhost/action/auto/deep/one'), 'auto + auto + local' );
72 is( $response->header('X-Catalyst-Executed'),
73 $expected, 'Executed actions' );
74 is( $response->content, 'deep one', 'Content OK' );
77 # test auto + auto + default
80 TestApp::Controller::Action::Auto::Deep->begin
81 TestApp::Controller::Action::Auto->auto
82 TestApp::Controller::Action::Auto::Deep->auto
83 TestApp::Controller::Action::Auto::Deep->default
86 my $expected = join( ", ", @expected );
88 ok( my $response = request('http://localhost/action/auto/deep/anything'), 'auto + auto + default' );
89 is( $response->header('X-Catalyst-Executed'),
90 $expected, 'Executed actions' );
91 is( $response->content, 'deep default', 'Content OK' );
94 # test auto + failing auto + local + end
97 TestApp::Controller::Action::Auto::Abort->begin
98 TestApp::Controller::Action::Auto->auto
99 TestApp::Controller::Action::Auto::Abort->auto
100 TestApp::Controller::Action::Auto::Abort->end
103 my $expected = join( ", ", @expected );
105 ok( my $response = request('http://localhost/action/auto/abort/one'), 'auto + failing auto + local' );
106 is( $response->header('X-Catalyst-Executed'),
107 $expected, 'Executed actions' );
108 is( $response->content, 'abort end', 'Content OK' );
111 # test auto + failing auto + default + end
114 TestApp::Controller::Action::Auto::Abort->begin
115 TestApp::Controller::Action::Auto->auto
116 TestApp::Controller::Action::Auto::Abort->auto
117 TestApp::Controller::Action::Auto::Abort->end
120 my $expected = join( ", ", @expected );
122 ok( my $response = request('http://localhost/action/auto/abort/anything'), 'auto + failing auto + default' );
123 is( $response->header('X-Catalyst-Executed'),
124 $expected, 'Executed actions' );
125 is( $response->content, 'abort end', 'Content OK' );