New test for no Args() order mismatch
Matt S Trout [Thu, 22 Jun 2006 14:53:33 +0000 (14:53 +0000)]
r10150@cain (orig r4428):  purge | 2006-06-21 15:15:09 +0000

t/lib/TestApp/Controller/Action/Chained.pm
t/live_component_controller_action_chained.t

index d93827d..18804af 100644 (file)
@@ -71,6 +71,7 @@ sub priority_a1 :PathPart('chained/priority_a') :Chained('/') :Args { }
 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
 #
@@ -79,6 +80,14 @@ sub priority_b2 :PathPart('chained/priority_b') :Chained('/') :CaptureArgs(1) {
 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('/') { }
index dca2385..b9367a2 100644 (file)
@@ -10,7 +10,7 @@ our $iters;
 
 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} ) {
@@ -364,6 +364,27 @@ sub run_tests {
     }
 
     #
+    #   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.
     #