--- /dev/null
+package TestApp::Controller::Action::ChildOf::PassedArgs;
+use warnings;
+use strict;
+
+use base qw( Catalyst::Controller );
+
+#
+# This controller builds a simple chain of three actions that
+# will output the arguments they got passed to @_ after the
+# context object. We do this to test if that passing works
+# as it should.
+#
+
+sub first : PathPart('childof/passedargs/a') ChildOf('/') Captures(1) {
+ my ( $self, $c, $arg ) = @_;
+ $c->stash->{ passed_args } = [ $arg ];
+}
+
+sub second : PathPart('b') ChildOf('first') Captures(1) {
+ my ( $self, $c, $arg ) = @_;
+ push @{ $c->stash->{ passed_args } }, $arg;
+}
+
+sub third : PathPart('c') ChildOf('second') Args(1) {
+ my ( $self, $c, $arg ) = @_;
+ push @{ $c->stash->{ passed_args } }, $arg;
+}
+
+sub end : Private {
+ my ( $self, $c ) = @_;
+ $c->response->body( join '; ', @{ $c->stash->{ passed_args } } );
+}
+
+1;
BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; }
-use Test::More tests => 54*$iters;
+use Test::More tests => 57*$iters;
use Catalyst::Test 'TestApp';
if ( $ENV{CAT_BENCHMARK} ) {
$expected, 'Executed actions' );
is( $response->content, '1; 2', 'Content OK' );
}
+
+ #
+ # This is for testing if the arguments got passed to the actions
+ # correctly.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::ChildOf->begin
+ TestApp::Controller::Action::ChildOf::PassedArgs->first
+ TestApp::Controller::Action::ChildOf::PassedArgs->second
+ TestApp::Controller::Action::ChildOf::PassedArgs->third
+ TestApp::Controller::Action::ChildOf::PassedArgs->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/childof/passedargs/a/1/b/2/c/3'),
+ 'Correct arguments passed to actions' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 2; 3', 'Content OK' );
+ }
}