[Catalyst-commits] r8175 - in Catalyst-Runtime/5.70/trunk/t: . lib/TestApp/Controller/Action/Chained

ash at dev.catalyst.perl.org ash at dev.catalyst.perl.org
Fri Aug 1 17:58:25 BST 2008


Author: ash
Date: 2008-08-01 17:58:25 +0100 (Fri, 01 Aug 2008)
New Revision: 8175

Modified:
   Catalyst-Runtime/5.70/trunk/t/lib/TestApp/Controller/Action/Chained/ParentChain.pm
   Catalyst-Runtime/5.70/trunk/t/live_component_controller_action_chained.t
Log:
TODO tests added for :ChainedParent and :Chained('../action') atrs

Modified: Catalyst-Runtime/5.70/trunk/t/lib/TestApp/Controller/Action/Chained/ParentChain.pm
===================================================================
--- Catalyst-Runtime/5.70/trunk/t/lib/TestApp/Controller/Action/Chained/ParentChain.pm	2008-08-01 01:37:45 UTC (rev 8174)
+++ Catalyst-Runtime/5.70/trunk/t/lib/TestApp/Controller/Action/Chained/ParentChain.pm	2008-08-01 16:58:25 UTC (rev 8175)
@@ -10,4 +10,16 @@
 #
 sub child :Chained('.') :Args(1) { }
 
+# Should be at /chained/rootdef/*/chained_rel
+sub chained_rel :Chained('../rootdef') Args(0) {
+}
+
+# Should chain to loose in parent namespace - i.e. at /chained/loose/*/loose/*/*
+sub loose : ChainedParent Args(2) {
+}
+
+# Should be at /chained/cross/*/up_down/*
+sub up_down : Chained('../bar/cross1') Args(1) {
+}
+
 1;

Modified: Catalyst-Runtime/5.70/trunk/t/live_component_controller_action_chained.t
===================================================================
--- Catalyst-Runtime/5.70/trunk/t/live_component_controller_action_chained.t	2008-08-01 01:37:45 UTC (rev 8174)
+++ Catalyst-Runtime/5.70/trunk/t/live_component_controller_action_chained.t	2008-08-01 16:58:25 UTC (rev 8175)
@@ -10,7 +10,7 @@
 
 BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
 
-use Test::More tests => 127*$iters;
+use Test::More tests => 136*$iters;
 use Catalyst::Test 'TestApp';
 
 if ( $ENV{CAT_BENCHMARK} ) {
@@ -528,6 +528,69 @@
     }
 
     #
+    #   Test if :Chained('../act') is working
+    #
+    {
+        local $TODO = "To Be Coded";
+        my @expected = qw[
+          TestApp::Controller::Action::Chained->begin
+          TestApp::Controller::Action::Chained->rootdef
+          TestApp::Controller::Action::Chained::ParentChain->chained_rel
+          TestApp::Controller::Action::Chained->end
+        ];
+
+        my $expected = join( ", ", @expected );
+
+        ok( my $response = request('http://localhost/chained/rootdef/1/chained_rel/3/2'),
+            ":Chained('../action') chains to correct action" );
+        is( $response->header('X-Catalyst-Executed'),
+            $expected, 'Executed actions' );
+        is( $response->content, '1; 3, 2', 'Content OK' );
+    }
+
+    #
+    #   Test if :ChainedParent is working
+    #
+    {
+        local $TODO = "To Be Coded";
+        my @expected = qw[
+          TestApp::Controller::Action::Chained->begin
+          TestApp::Controller::Action::Chained->loose
+          TestApp::Controller::Action::Chained::ParentChain->loose
+          TestApp::Controller::Action::Chained->end
+        ];
+
+        my $expected = join( ", ", @expected );
+
+        ok( my $response = request('http://localhost/chained/loose/4/loose/a/b'),
+            ":Chained('../action') chains to correct action" );
+        is( $response->header('X-Catalyst-Executed'),
+            $expected, 'Executed actions' );
+        is( $response->content, '4; a, b', 'Content OK' );
+    }
+
+    #
+    #   Test if :Chained('../name/act') is working
+    #
+    {
+        local $TODO = "To Be Coded";
+        my @expected = qw[
+          TestApp::Controller::Action::Chained->begin
+          TestApp::Controller::Action::Chained::Bar->cross1
+          TestApp::Controller::Action::Chained::ParentChain->up_down
+          TestApp::Controller::Action::Chained->end
+        ];
+
+        my $expected = join( ", ", @expected );
+
+        ok( my $response = request('http://localhost/chained/cross/4/up_down/5'),
+            ":Chained('../action') chains to correct action" );
+        is( $response->header('X-Catalyst-Executed'),
+            $expected, 'Executed actions' );
+        is( $response->content, '4; 5', 'Content OK' );
+    }
+
+    #
     #   Test behaviour of auto actions returning '1' for the chain.
     #
     {




More information about the Catalyst-commits mailing list