7 use lib "$FindBin::Bin/../../../lib";
9 use Test::More tests => 180;
10 use Catalyst::Test 'TestApp';
13 # test auto + local method
16 TestApp::Controller::Action::Auto->begin
17 TestApp::Controller::Action::Auto->auto
18 TestApp::Controller::Action::Auto->one
21 my $expected = join( ", ", @expected );
23 ok( my $response = request('http://localhost/action/auto/one'), 'auto + local' );
24 is( $response->header('X-Catalyst-Executed'),
25 $expected, 'Executed actions' );
26 is( $response->content, 'one', 'Content OK' );
32 TestApp::Controller::Action::Auto->begin
33 TestApp::Controller::Action::Auto->auto
34 TestApp::Controller::Action::Auto->default
37 my $expected = join( ", ", @expected );
39 ok( my $response = request('http://localhost/action/auto/anything'), 'auto + default' );
40 is( $response->header('X-Catalyst-Executed'),
41 $expected, 'Executed actions' );
42 is( $response->content, 'default', 'Content OK' );
45 # test auto + auto + local
48 TestApp::Controller::Action::Auto::Deep->begin
49 TestApp::Controller::Action::Auto->auto
50 TestApp::Controller::Action::Auto::Deep->auto
51 TestApp::Controller::Action::Auto::Deep->one
54 my $expected = join( ", ", @expected );
56 ok( my $response = request('http://localhost/action/auto/deep/one'), 'auto + auto + local' );
57 is( $response->header('X-Catalyst-Executed'),
58 $expected, 'Executed actions' );
59 is( $response->content, 'deep one', 'Content OK' );
62 # test auto + auto + default
65 TestApp::Controller::Action::Auto::Deep->begin
66 TestApp::Controller::Action::Auto->auto
67 TestApp::Controller::Action::Auto::Deep->auto
68 TestApp::Controller::Action::Auto::Deep->default
71 my $expected = join( ", ", @expected );
73 ok( my $response = request('http://localhost/action/auto/deep/anything'), 'auto + auto + default' );
74 is( $response->header('X-Catalyst-Executed'),
75 $expected, 'Executed actions' );
76 is( $response->content, 'deep default', 'Content OK' );
79 # test auto + failing auto + local + end
82 TestApp::Controller::Action::Auto::Abort->begin
83 TestApp::Controller::Action::Auto->auto
84 TestApp::Controller::Action::Auto::Abort->auto
85 TestApp::Controller::Action::Auto::Abort->end
88 my $expected = join( ", ", @expected );
90 ok( my $response = request('http://localhost/action/auto/abort/one'), 'auto + failing auto + local' );
91 is( $response->header('X-Catalyst-Executed'),
92 $expected, 'Executed actions' );
93 is( $response->content, 'abort end', 'Content OK' );
96 # test auto + failing auto + default + end
99 TestApp::Controller::Action::Auto::Abort->begin
100 TestApp::Controller::Action::Auto->auto
101 TestApp::Controller::Action::Auto::Abort->auto
102 TestApp::Controller::Action::Auto::Abort->end
105 my $expected = join( ", ", @expected );
107 ok( my $response = request('http://localhost/action/auto/abort/anything'), 'auto + failing auto + default' );
108 is( $response->header('X-Catalyst-Executed'),
109 $expected, 'Executed actions' );
110 is( $response->content, 'abort end', 'Content OK' );