new test suit
[catagits/Catalyst-Runtime.git] / t / 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->begin
16         TestApp::Controller::Action::Forward->begin
17         TestApp::Controller::Action::Forward->one
18         TestApp::Controller::Action::Forward->two
19         TestApp::Controller::Action::Forward->three
20         TestApp::Controller::Action::Forward->four
21         TestApp::Controller::Action::Forward->five
22         TestApp::View::Dump::Request->process
23     ];
24
25     my $expected = join( ", ", @expected );
26
27     ok( my $response = request('http://localhost/action/forward/one'), 'Request' );
28     ok( $response->is_success, 'Response Successful 2xx' );
29     is( $response->content_type, 'text/plain', 'Response Content-Type' );
30     is( $response->header('X-Catalyst-Action'), 'action/forward/one', 'Test Action' );
31     is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Forward', 'Test Class' );
32     is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' );
33     like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' );
34 }
35
36 {
37     my @expected = qw[
38         TestApp::Controller::Action->begin
39         TestApp::Controller::Action::Forward->begin
40         TestApp::Controller::Action::Forward->jojo
41         TestApp::Controller::Action::Forward->one
42         TestApp::Controller::Action::Forward->two
43         TestApp::Controller::Action::Forward->three
44         TestApp::Controller::Action::Forward->four
45         TestApp::Controller::Action::Forward->five
46         TestApp::View::Dump::Request->process
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     ];
52
53     my $expected = join( ", ", @expected );
54
55     ok( my $response = request('http://localhost/action/forward/jojo'), 'Request' );
56     ok( $response->is_success, 'Response Successful 2xx' );
57     is( $response->content_type, 'text/plain', 'Response Content-Type' );
58     is( $response->header('X-Catalyst-Action'), 'action/forward/jojo', 'Test Action' );
59     is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Forward', 'Test Class' );
60     is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' );
61     like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' );
62 }