Commit | Line | Data |
dd4e6fd2 |
1 | #!perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use FindBin; |
9770ad56 |
7 | use lib "$FindBin::Bin/../../../lib"; |
dd4e6fd2 |
8 | |
d8c66af5 |
9 | use Test::More tests => 210; |
dd4e6fd2 |
10 | use Catalyst::Test 'TestApp'; |
11 | |
d8c66af5 |
12 | for ( 1 .. 10 ) { |
13 | { |
14 | my @expected = qw[ |
15 | TestApp::Controller::Action::Inheritance->begin |
16 | TestApp::Controller::Action::Inheritance->auto |
17 | TestApp::Controller::Action::Inheritance->default |
18 | TestApp::View::Dump::Request->process |
19 | TestApp::Controller::Action::Inheritance->end |
20 | ]; |
dd4e6fd2 |
21 | |
d8c66af5 |
22 | my $expected = join( ", ", @expected ); |
dd4e6fd2 |
23 | |
d8c66af5 |
24 | ok( my $response = request('http://localhost/action/inheritance'), |
25 | 'Request' ); |
26 | ok( $response->is_success, 'Response Successful 2xx' ); |
27 | is( $response->content_type, 'text/plain', 'Response Content-Type' ); |
28 | is( $response->header('X-Catalyst-Action'), 'default', 'Test Action' ); |
29 | is( |
30 | $response->header('X-Test-Class'), |
31 | 'TestApp::Controller::Action::Inheritance', |
32 | 'Test Class' |
33 | ); |
34 | is( $response->header('X-Catalyst-Executed'), |
35 | $expected, 'Executed actions' ); |
36 | like( |
37 | $response->content, |
38 | qr/^bless\( .* 'Catalyst::Request' \)$/s, |
39 | 'Content is a serialized Catalyst::Request' |
40 | ); |
41 | } |
dd4e6fd2 |
42 | |
d8c66af5 |
43 | { |
44 | my @expected = qw[ |
45 | TestApp::Controller::Action::Inheritance::A->begin |
46 | TestApp::Controller::Action::Inheritance->auto |
47 | TestApp::Controller::Action::Inheritance::A->auto |
48 | TestApp::Controller::Action::Inheritance::A->default |
49 | TestApp::View::Dump::Request->process |
50 | TestApp::Controller::Action::Inheritance::A->end |
51 | ]; |
dd4e6fd2 |
52 | |
d8c66af5 |
53 | my $expected = join( ", ", @expected ); |
dd4e6fd2 |
54 | |
d8c66af5 |
55 | ok( my $response = request('http://localhost/action/inheritance/a'), |
56 | 'Request' ); |
57 | ok( $response->is_success, 'Response Successful 2xx' ); |
58 | is( $response->content_type, 'text/plain', 'Response Content-Type' ); |
59 | is( $response->header('X-Catalyst-Action'), 'default', 'Test Action' ); |
60 | is( |
61 | $response->header('X-Test-Class'), |
62 | 'TestApp::Controller::Action::Inheritance::A', |
63 | 'Test Class' |
64 | ); |
65 | is( $response->header('X-Catalyst-Executed'), |
66 | $expected, 'Executed actions' ); |
67 | like( |
68 | $response->content, |
69 | qr/^bless\( .* 'Catalyst::Request' \)$/s, |
70 | 'Content is a serialized Catalyst::Request' |
71 | ); |
72 | } |
dd4e6fd2 |
73 | |
d8c66af5 |
74 | { |
75 | my @expected = qw[ |
76 | TestApp::Controller::Action::Inheritance::A::B->begin |
77 | TestApp::Controller::Action::Inheritance->auto |
78 | TestApp::Controller::Action::Inheritance::A->auto |
79 | TestApp::Controller::Action::Inheritance::A::B->auto |
80 | TestApp::Controller::Action::Inheritance::A::B->default |
81 | TestApp::View::Dump::Request->process |
82 | TestApp::Controller::Action::Inheritance::A::B->end |
83 | ]; |
dd4e6fd2 |
84 | |
d8c66af5 |
85 | my $expected = join( ", ", @expected ); |
dd4e6fd2 |
86 | |
d8c66af5 |
87 | ok( my $response = request('http://localhost/action/inheritance/a/b'), |
88 | 'Request' ); |
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'), 'default', 'Test Action' ); |
92 | is( |
93 | $response->header('X-Test-Class'), |
94 | 'TestApp::Controller::Action::Inheritance::A::B', |
95 | 'Test Class' |
96 | ); |
97 | is( $response->header('X-Catalyst-Executed'), |
98 | $expected, 'Executed actions' ); |
99 | like( |
100 | $response->content, |
101 | qr/^bless\( .* 'Catalyst::Request' \)$/s, |
102 | 'Content is a serialized Catalyst::Request' |
103 | ); |
104 | } |
dd4e6fd2 |
105 | } |