update @INC
[catagits/Catalyst-Runtime.git] / t / component / controller / action / forward.t
CommitLineData
dd4e6fd2 1#!perl
2
3use strict;
4use warnings;
5
6use FindBin;
9770ad56 7use lib "$FindBin::Bin/../../../lib";
dd4e6fd2 8
9use Test::More no_plan => 1;
10use 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
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[
dd4e6fd2 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}