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 | |
c20bd9d9 |
9 | use Test::More tests => 18; |
dd4e6fd2 |
10 | use Catalyst::Test 'TestApp'; |
11 | |
12 | |
13 | { |
14 | my @expected = qw[ |
dd4e6fd2 |
15 | TestApp::Controller::Action::Forward->begin |
16 | TestApp::Controller::Action::Forward->one |
17 | TestApp::Controller::Action::Forward->two |
18 | TestApp::Controller::Action::Forward->three |
19 | TestApp::Controller::Action::Forward->four |
20 | TestApp::Controller::Action::Forward->five |
21 | TestApp::View::Dump::Request->process |
22 | ]; |
23 | |
24 | my $expected = join( ", ", @expected ); |
25 | |
2656a6de |
26 | # Test forward to global private action |
e5d7f18c |
27 | ok( my $response = request('http://localhost/action/forward/global'), 'Request' ); |
2656a6de |
28 | ok( $response->is_success, 'Response Successful 2xx' ); |
29 | is( $response->content_type, 'text/plain', 'Response Content-Type' ); |
e5d7f18c |
30 | is( $response->header('X-Catalyst-Action'), 'action/forward/global', 'Main Class Action' ); |
2656a6de |
31 | # Test forward to chain of actions. |
32 | ok( $response = request('http://localhost/action/forward/one'), 'Request' ); |
dd4e6fd2 |
33 | ok( $response->is_success, 'Response Successful 2xx' ); |
34 | is( $response->content_type, 'text/plain', 'Response Content-Type' ); |
35 | is( $response->header('X-Catalyst-Action'), 'action/forward/one', 'Test Action' ); |
36 | is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Forward', 'Test Class' ); |
37 | is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); |
38 | like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); |
39 | } |
40 | |
41 | { |
42 | my @expected = qw[ |
dd4e6fd2 |
43 | TestApp::Controller::Action::Forward->begin |
44 | TestApp::Controller::Action::Forward->jojo |
45 | TestApp::Controller::Action::Forward->one |
46 | TestApp::Controller::Action::Forward->two |
47 | TestApp::Controller::Action::Forward->three |
48 | TestApp::Controller::Action::Forward->four |
49 | TestApp::Controller::Action::Forward->five |
50 | TestApp::View::Dump::Request->process |
51 | TestApp::Controller::Action::Forward->three |
52 | TestApp::Controller::Action::Forward->four |
53 | TestApp::Controller::Action::Forward->five |
54 | TestApp::View::Dump::Request->process |
55 | ]; |
56 | |
57 | my $expected = join( ", ", @expected ); |
58 | |
59 | ok( my $response = request('http://localhost/action/forward/jojo'), 'Request' ); |
60 | ok( $response->is_success, 'Response Successful 2xx' ); |
61 | is( $response->content_type, 'text/plain', 'Response Content-Type' ); |
62 | is( $response->header('X-Catalyst-Action'), 'action/forward/jojo', 'Test Action' ); |
63 | is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Forward', 'Test Class' ); |
64 | is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); |
65 | like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); |
66 | } |