BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
-use Test::More tests => 54 * $iters;
+use Test::More tests => 60 * $iters;
use Catalyst::Test 'TestApp';
if ( $ENV{CAT_BENCHMARK} ) {
my $expected = join( ", ", @expected );
- ok( my $response = request('http://localhost/action/visit/visit_chained'), 'visit to chained + subcontroller endpoint' );
- is( $response->header('X-Catalyst-Executed'),
- $expected, 'Executed actions' );
- is( $response->content, '; 1', 'Content OK' );
+ for my $i ( 1..3 ) {
+ ok( my $response = request("http://localhost/action/visit/visit_chained/$i"),
+ "visit to chained + subcontroller endpoint for $i" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, "Executed actions for $i" );
+ is( $response->content, "; $i", "Content OK for $i" );
+ }
}
}
#
# Simple parent/child action test
#
-sub foo :PathPart('chained/foo') :CaptureArgs(1) :Chained('/') { }
+sub foo :PathPart('chained/foo') :CaptureArgs(1) :Chained('/') {
+ my ( $self, $c, @args ) = @_;
+ die "missing argument" unless @args;
+ die "more than 1 argument" if @args > 1;
+}
sub endpoint :PathPart('end') :Chained('/action/chained/foo') :Args(1) { }
#
sub visit_chained : Local {
my ( $self, $c, $val ) = @_;
- $c->visit('/action/chained/foo/spoon',[1]);
+ $val eq 1 ? $c->visit( '/action/chained/foo/spoon', [$val] )
+ : $val eq 2 ? $c->visit( qw/ Action::Chained::Foo spoon /, [$val] )
+ : $c->visit( $c->controller('Action::Chained::Foo')->action_for('spoon'), [$val] )
}
sub view : Local {