update @INC
[catagits/Catalyst-Runtime.git] / t / component / controller / action / forward.t
1 #!perl
2
3 use strict;
4 use warnings;
5
6 use FindBin;
7 use lib "$FindBin::Bin/../../../lib";
8
9 use Test::More no_plan => 1;
10 use Catalyst::Test 'TestApp';
11
12
13 {
14     my @expected = qw[
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
26     ok( my $response = request('http://localhost/action/forward/one'), 'Request' );
27     ok( $response->is_success, 'Response Successful 2xx' );
28     is( $response->content_type, 'text/plain', 'Response Content-Type' );
29     is( $response->header('X-Catalyst-Action'), 'action/forward/one', 'Test Action' );
30     is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Forward', 'Test Class' );
31     is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' );
32     like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' );
33 }
34
35 {
36     my @expected = qw[
37         TestApp::Controller::Action::Forward->begin
38         TestApp::Controller::Action::Forward->jojo
39         TestApp::Controller::Action::Forward->one
40         TestApp::Controller::Action::Forward->two
41         TestApp::Controller::Action::Forward->three
42         TestApp::Controller::Action::Forward->four
43         TestApp::Controller::Action::Forward->five
44         TestApp::View::Dump::Request->process
45         TestApp::Controller::Action::Forward->three
46         TestApp::Controller::Action::Forward->four
47         TestApp::Controller::Action::Forward->five
48         TestApp::View::Dump::Request->process
49     ];
50
51     my $expected = join( ", ", @expected );
52
53     ok( my $response = request('http://localhost/action/forward/jojo'), 'Request' );
54     ok( $response->is_success, 'Response Successful 2xx' );
55     is( $response->content_type, 'text/plain', 'Response Content-Type' );
56     is( $response->header('X-Catalyst-Action'), 'action/forward/jojo', 'Test Action' );
57     is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Forward', 'Test Class' );
58     is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' );
59     like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' );
60 }