From #catalyst-dev before
Tomas Doran [Wed, 4 Mar 2009 16:51:23 +0000 (16:51 +0000)]
TODO
t/aggregate/live_component_controller_action_inheritance.t
t/lib/TestApp/Controller/Action/Inheritance.pm
t/lib/TestApp/ControllerBase/Middle.pm [new file with mode: 0644]
t/lib/TestApp/ControllerBase/OtherRoot.pm [new file with mode: 0644]
t/lib/TestApp/ControllerBase/RealMiddle.pm [new file with mode: 0644]
t/lib/TestApp/ControllerBase/Root.pm [new file with mode: 0644]

diff --git a/TODO b/TODO
index e96c161..b8cffd1 100644 (file)
--- a/TODO
+++ b/TODO
@@ -4,6 +4,9 @@ Compatibility:
    - Provide an extension so that components can have a Moose::Object
      constructor and an @ISA which makes c3 happy on both 5.7X and 5.8X.
 
+   - $self->config should warn as config should only ever be called as a
+     class method.
+
 Testing:
 
    - Run more smokes
index c58866b..4a434e0 100644 (file)
@@ -10,7 +10,7 @@ our $iters;
 
 BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
 
-use Test::More tests => 21*$iters;
+use Test::More tests => 26*$iters;
 use Catalyst::Test 'TestApp';
 
 if ( $ENV{CAT_BENCHMARK} ) {
@@ -116,4 +116,26 @@ sub run_tests {
             'Content is a serialized Catalyst::Request'
         );
     }
+
+    {
+        my @expected = qw[
+          TestApp::Controller::Action::Inheritance->begin
+          TestApp::Controller::Action::Inheritance->auto
+          TestApp::Controller::Action::Inheritance::Chained->chain_root
+          TestApp::Controller::Action::Inheritance::Chained->chain_first
+          TestApp::Controller::Action::Inheritance::Chained->chain_middle
+          TestApp::Controller::Action::Inheritance::Chained->chain_end
+          TestApp::Controller::Action::Inheritance->end
+        ];
+
+        my $expected = join( ", ", @expected );
+
+        ok( my $response = request('http://localhost/action/inheritance/chained/chain_end'),
+            'Request' );
+        ok( $response->is_success, 'Response Successful 2xx' );
+        is( $response->content_type, 'text/plain', 'Response Content-Type' );
+        is( $response->header('X-Catalyst-Action'), '/action/inheritance/chained/chain_end', 'Test Action' );
+        is( $response->header('X-Catalyst-Executed'),
+            $expected, 'Executed actions' );
+    }
 }
index 6eae935..bed68e4 100644 (file)
@@ -70,5 +70,13 @@ sub end : Private {
     my ( $self, $c ) = @_;
 }
 
+package TestApp::Controller::Action::Inheritance::Chained;
+
+use strict;
+use base qw/TestApp::ControllerBase::Middle TestApp::ControllerBase::RealMiddle/;
+
+sub chain_first : CaptureArgs(0) PathPart('') Chained('chain_root') {}
+
+
 1;
 
diff --git a/t/lib/TestApp/ControllerBase/Middle.pm b/t/lib/TestApp/ControllerBase/Middle.pm
new file mode 100644 (file)
index 0000000..38a4a74
--- /dev/null
@@ -0,0 +1,11 @@
+package TestApp::ControllerBase::Middle;
+
+use Moose;
+
+use namespace::clean -except => 'meta';
+
+BEGIN { extends qw/TestApp::ControllerBase::Root/; }
+
+__PACKAGE__->meta->make_immutable;
+
+1;
diff --git a/t/lib/TestApp/ControllerBase/OtherRoot.pm b/t/lib/TestApp/ControllerBase/OtherRoot.pm
new file mode 100644 (file)
index 0000000..0c2c51f
--- /dev/null
@@ -0,0 +1,13 @@
+package TestApp::ControllerBase::OtherRoot;
+
+use Moose;
+
+use namespace::clean -except => 'meta';
+
+BEGIN { extends qw/Catalyst::Controller/; }
+
+sub chain_middle : CaptureArgs(0) PathPart('') Chained('chain_first') {}
+
+__PACKAGE__->meta->make_immutable;
+
+1;
diff --git a/t/lib/TestApp/ControllerBase/RealMiddle.pm b/t/lib/TestApp/ControllerBase/RealMiddle.pm
new file mode 100644 (file)
index 0000000..790a07d
--- /dev/null
@@ -0,0 +1,11 @@
+package TestApp::ControllerBase::RealMiddle;
+
+use Moose;
+
+use namespace::clean -except => 'meta';
+
+BEGIN { extends qw/TestApp::ControllerBase::OtherRoot/; }
+
+__PACKAGE__->meta->make_immutable;
+
+1;
diff --git a/t/lib/TestApp/ControllerBase/Root.pm b/t/lib/TestApp/ControllerBase/Root.pm
new file mode 100644 (file)
index 0000000..9f1b094
--- /dev/null
@@ -0,0 +1,15 @@
+package TestApp::ControllerBase::Root;
+
+use Moose;
+
+use namespace::clean -except => 'meta';
+
+BEGIN { extends qw/Catalyst::Controller/; }
+
+sub chain_root : Chained('/') PathPrefix CaptureArgs(0) {}
+
+sub chain_end : Chained('chain_middle') Args(0) {}
+
+__PACKAGE__->meta->make_immutable;
+
+1;