-#!perl\r
-\r
-use strict;\r
-use warnings;\r
-\r
-use FindBin;\r
-use lib "$FindBin::Bin/lib";\r
-\r
-our $iters;\r
-\r
-BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; }\r
-\r
-use Test::More tests => 18*$iters;\r
-use Catalyst::Test 'TestApp';\r
-\r
-if ( $ENV{CAT_BENCHMARK} ) {\r
- require Benchmark;\r
- Benchmark::timethis( $iters, \&run_tests );\r
-}\r
-else {\r
- for ( 1 .. $iters ) {\r
- run_tests();\r
- }\r
-}\r
-\r
-sub run_tests {\r
- {\r
- my @expected = qw[\r
- TestApp::Controller::Action::Detach->begin\r
- TestApp::Controller::Action::Detach->one\r
- TestApp::Controller::Action::Detach->two\r
- TestApp::View::Dump::Request->process\r
- TestApp->end\r
- ];\r
-\r
- my $expected = join( ", ", @expected );\r
-\r
- # Test detach to chain of actions.\r
- ok( my $response = request('http://localhost/action/detach/one'),\r
- 'Request' );\r
- ok( $response->is_success, 'Response Successful 2xx' );\r
- is( $response->content_type, 'text/plain', 'Response Content-Type' );\r
- is( $response->header('X-Catalyst-Action'),\r
- 'action/detach/one', 'Test Action' );\r
- is(\r
- $response->header('X-Test-Class'),\r
- 'TestApp::Controller::Action::Detach',\r
- 'Test Class'\r
- );\r
- is( $response->header('X-Catalyst-Executed'),\r
- $expected, 'Executed actions' );\r
- }\r
-\r
- {\r
- my @expected = qw[\r
- TestApp::Controller::Action::Detach->begin\r
- TestApp::Controller::Action::Detach->path\r
- TestApp::Controller::Action::Detach->two\r
- TestApp::View::Dump::Request->process\r
- TestApp->end\r
- ];\r
-\r
- my $expected = join( ", ", @expected );\r
-\r
- # Test detach to chain of actions.\r
- ok( my $response = request('http://localhost/action/detach/path'),\r
- 'Request' );\r
- ok( $response->is_success, 'Response Successful 2xx' );\r
- is( $response->content_type, 'text/plain', 'Response Content-Type' );\r
- is( $response->header('X-Catalyst-Action'),\r
- 'action/detach/path', 'Test Action' );\r
- is(\r
- $response->header('X-Test-Class'),\r
- 'TestApp::Controller::Action::Detach',\r
- 'Test Class'\r
- );\r
- is( $response->header('X-Catalyst-Executed'),\r
- $expected, 'Executed actions' );\r
- }\r
-\r
- {\r
- ok(\r
- my $response =\r
- request('http://localhost/action/detach/with_args/old'),\r
- 'Request with args'\r
- );\r
- ok( $response->is_success, 'Response Successful 2xx' );\r
- is( $response->content, 'new' );\r
- }\r
-\r
- {\r
- ok(\r
- my $response = request(\r
- 'http://localhost/action/detach/with_method_and_args/old'),\r
- 'Request with args and method'\r
- );\r
- ok( $response->is_success, 'Response Successful 2xx' );\r
- is( $response->content, 'new' );\r
- }\r
-}\r
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 18*$iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Detach->begin
+ TestApp::Controller::Action::Detach->one
+ TestApp::Controller::Action::Detach->two
+ TestApp::View::Dump::Request->process
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ # Test detach to chain of actions.
+ ok( my $response = request('http://localhost/action/detach/one'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/detach/one', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Detach',
+ 'Test Class'
+ );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ }
+
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Detach->begin
+ TestApp::Controller::Action::Detach->path
+ TestApp::Controller::Action::Detach->two
+ TestApp::View::Dump::Request->process
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ # Test detach to chain of actions.
+ ok( my $response = request('http://localhost/action/detach/path'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/detach/path', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Detach',
+ 'Test Class'
+ );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ }
+
+ {
+ ok(
+ my $response =
+ request('http://localhost/action/detach/with_args/old'),
+ 'Request with args'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content, 'new' );
+ }
+
+ {
+ ok(
+ my $response = request(
+ 'http://localhost/action/detach/with_method_and_args/old'),
+ 'Request with args and method'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content, 'new' );
+ }
+}