our $iters;
-BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; }
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
-use Test::More tests => 103*$iters;
+use Test::More tests => 109*$iters;
use Catalyst::Test 'TestApp';
if ( $ENV{CAT_BENCHMARK} ) {
'chained + local endpoint; missing last argument' );
is( $response->header('X-Catalyst-Executed'),
$expected, 'Executed actions' );
- is( $response->header('Status'), 500, 'Status OK' );
+ is( $response->code, 500, 'Status OK' );
}
#
'multi-action (three args, should lead to error)' );
is( $response->header('X-Catalyst-Executed'),
$expected, 'Executed actions' );
- is( $response->header('Status'), 500, 'Status OK' );
+ is( $response->code, 500, 'Status OK' );
}
#
"Loose end is not callable" );
is( $response->header('X-Catalyst-Executed'),
$expected, 'Executed actions' );
- is( $response->header('Status'), 500, 'Status OK' );
+ is( $response->code, 500, 'Status OK' );
}
#
ok( my $response = request(
'http://localhost/action/chained/to_root' ),
'uri_for with chained root action as arg' );
- is( $response->content,
- 'URI:http://localhost/',
+ like( $response->content,
+ qr(URI:http://[^/]+/),
'Correct URI generated' );
}
}
else { pass( "Error on absolute path part arguments already tested" ) }
}
+
+ #
+ # Test chained actions in the root controller
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained::Root->rootsub
+ TestApp::Controller::Action::Chained::Root->endpointsub
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/rootsub/1/endpointsub/2'), 'chained in root namespace' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '', 'Content OK' );
+ }
+
+ #
+ # Complex path with multiple empty pathparts
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->mult_nopp_base
+ TestApp::Controller::Action::Chained->mult_nopp_all
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/mult_nopp'),
+ "Complex path with multiple empty pathparts" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '; ', 'Content OK' );
+ }
+
}