auto/forward/detach tests for Chained
[catagits/Catalyst-Runtime.git] / t / lib / TestApp / Controller / Action / Chained.pm
index 6bb0acf..eaaf3e9 100644 (file)
@@ -9,9 +9,7 @@ sub begin :Private { }
 
 #
 #   TODO
-#   :Chained('') defaulting to controller namespace
-#   :Chained('..') defaulting to action in controller above
-#   :Chained == Chained('/')
+#   :Chained('') means what?
 #
 
 #
@@ -97,6 +95,43 @@ sub opt_pathpart :Chained('opt_pp_start') :Args(1) { }
 sub opt_all_start :Chained('/') :PathPart('chained/optall') :Captures(1) { }
 sub oa :Chained('opt_all_start') { }
 
+#
+#   :Chained is the same as :Chained('/')
+#
+sub rootdef :Chained :PathPart('chained/rootdef') :Args(1) { }
+
+#
+#   the ParentChain controller chains to this action by
+#   specifying :Chained('.')
+#
+sub parentchain :Chained('/') :PathPart('chained/parentchain') :Captures(1) { }
+
+#
+#   This is just for a test that a loose end is not callable
+#
+sub loose :Chained :PathPart('chained/loose') Captures(1) { }
+
+#
+#   Forwarding out of the middle of a chain.
+#
+sub chain_fw_a :Chained :PathPart('chained/chain_fw') :Captures(1) {
+    $_[1]->forward( '/action/chained/fw_dt_target' );
+}
+sub chain_fw_b :Chained('chain_fw_a') :PathPart('end') :Args(1) { }
+
+#
+#   Detaching out of the middle of a chain.
+#
+sub chain_dt_a :Chained :PathPart('chained/chain_dt') :Captures(1) {
+    $_[1]->detach( '/action/chained/fw_dt_target' );
+}
+sub chain_dt_b :Chained('chain_dt_a') :PathPart('end') :Args(1) { }
+
+#
+#   Target for former forward and chain tests.
+#
+sub fw_dt_target :Private { }
+
 sub end :Private {
   my ($self, $c) = @_;
   my $out = join('; ', map { join(', ', @$_) }