sub priority_a2 :PathPart('chained/priority_a') :Chained('/') :CaptureArgs(1) { }
sub priority_a2_end :PathPart('end') :Chained('priority_a2') :Args(1) { }
+
#
# Priority: Fixed args vs. chained actions
#
sub priority_b2_end :PathPart('end') :Chained('priority_b2') :Args(1) { }
#
+# Priority: With no Args()
+#
+sub priority_c1 :PathPart('chained/priority_c') :Chained('/') :CaptureArgs(1) { }
+sub priority_c2 :PathPart('') :Chained('priority_c1') { }
+sub priority_c2_xyz :PathPart('xyz') :Chained('priority_c1') { }
+
+
+#
# Optional specification of :Args in endpoint
#
sub opt_args :PathPart('chained/opt_args') :Chained('/') { }
BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; }
-use Test::More tests => 96*$iters;
+use Test::More tests => 99*$iters;
use Catalyst::Test 'TestApp';
if ( $ENV{CAT_BENCHMARK} ) {
}
#
+ # This belongs to the former test but tests if two chained actions have
+ # priority over an action with one child action not having the Args() attr set.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->priority_c1
+ TestApp::Controller::Action::Chained->priority_c2_xyz
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/priority_c/1/xyz/'),
+ 'priority - no Args() order mismatch' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; ', 'Content OK' );
+ }
+
+ #
# Test dispatching between two controllers that are on the same level and
# therefor have no parent/child relationship.
#