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 | |
9 | use Test::More no_plan => 1; |
10 | use Catalyst::Test 'TestApp'; |
11 | |
12 | |
13 | { |
14 | my @expected = qw[ |
dd4e6fd2 |
15 | TestApp::Controller::Action::Inheritance->begin |
7088334d |
16 | TestApp::Controller::Action::Inheritance->auto |
dd4e6fd2 |
17 | TestApp::Controller::Action::Inheritance->default |
18 | TestApp::View::Dump::Request->process |
19 | TestApp::Controller::Action::Inheritance->end |
20 | ]; |
21 | |
22 | my $expected = join( ", ", @expected ); |
23 | |
24 | ok( my $response = request('http://localhost/action/inheritance'), 'Request' ); |
25 | ok( $response->is_success, 'Response Successful 2xx' ); |
26 | is( $response->content_type, 'text/plain', 'Response Content-Type' ); |
27 | is( $response->header('X-Catalyst-Action'), 'default', 'Test Action' ); |
28 | is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Inheritance', 'Test Class' ); |
29 | is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); |
30 | like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); |
31 | } |
32 | |
33 | { |
34 | my @expected = qw[ |
dd4e6fd2 |
35 | TestApp::Controller::Action::Inheritance::A->begin |
7088334d |
36 | TestApp::Controller::Action::Inheritance->auto |
37 | TestApp::Controller::Action::Inheritance::A->auto |
dd4e6fd2 |
38 | TestApp::Controller::Action::Inheritance::A->default |
39 | TestApp::View::Dump::Request->process |
40 | TestApp::Controller::Action::Inheritance::A->end |
dd4e6fd2 |
41 | ]; |
42 | |
43 | my $expected = join( ", ", @expected ); |
44 | |
45 | ok( my $response = request('http://localhost/action/inheritance/a'), 'Request' ); |
46 | ok( $response->is_success, 'Response Successful 2xx' ); |
47 | is( $response->content_type, 'text/plain', 'Response Content-Type' ); |
48 | is( $response->header('X-Catalyst-Action'), 'default', 'Test Action' ); |
49 | is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Inheritance::A', 'Test Class' ); |
50 | is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); |
51 | like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); |
52 | } |
53 | |
54 | { |
55 | my @expected = qw[ |
dd4e6fd2 |
56 | TestApp::Controller::Action::Inheritance::A::B->begin |
7088334d |
57 | TestApp::Controller::Action::Inheritance->auto |
58 | TestApp::Controller::Action::Inheritance::A->auto |
59 | TestApp::Controller::Action::Inheritance::A::B->auto |
dd4e6fd2 |
60 | TestApp::Controller::Action::Inheritance::A::B->default |
61 | TestApp::View::Dump::Request->process |
62 | TestApp::Controller::Action::Inheritance::A::B->end |
dd4e6fd2 |
63 | ]; |
64 | |
65 | my $expected = join( ", ", @expected ); |
66 | |
67 | ok( my $response = request('http://localhost/action/inheritance/a/b'), 'Request' ); |
68 | ok( $response->is_success, 'Response Successful 2xx' ); |
69 | is( $response->content_type, 'text/plain', 'Response Content-Type' ); |
70 | is( $response->header('X-Catalyst-Action'), 'default', 'Test Action' ); |
71 | is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Inheritance::A::B', 'Test Class' ); |
72 | is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); |
73 | like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); |
74 | } |