added 17inheritance.t
Christian Hansen [Wed, 23 Mar 2005 22:34:15 +0000 (22:34 +0000)]
t/17inheritance.t [new file with mode: 0644]

diff --git a/t/17inheritance.t b/t/17inheritance.t
new file mode 100644 (file)
index 0000000..fa187e5
--- /dev/null
@@ -0,0 +1,68 @@
+package TestApp;
+
+use Catalyst qw[-Engine=Test];
+
+__PACKAGE__->action(
+
+    '!begin' => sub {
+        my ( $self, $c ) = @_;
+        $c->res->headers->content_type('text/plain');
+    }
+);
+
+package TestApp::C::Foo;
+
+TestApp->action(
+
+    '!begin' => sub {
+        my ( $self, $c ) = @_;
+        $c->res->output( 'foo' . $c->res->output  );
+    },
+
+    '!default' => sub { 
+        my ( $self, $c ) = @_;
+        $c->res->output( 'foo' . $c->res->output );
+     },
+
+    '!end' => sub {
+        my ( $self, $c ) = @_;
+        $c->res->output( 'foo' . $c->res->output );
+    },
+);
+
+package TestApp::C::Foo::Bar;
+
+TestApp->action(
+
+    '!begin' => sub {
+        my ( $self, $c ) = @_;
+        $c->res->output( $c->res->output . 'bar' );
+    },
+
+    '!default' => sub { 
+        my ( $self, $c ) = @_;
+        $c->res->output( $c->res->output . 'bar' );
+     },
+
+    '!end' => sub {
+        my ( $self, $c ) = @_;
+        $c->res->output( $c->res->output . 'bar' );
+    },
+);
+
+package main;
+
+use Test::More tests => 2;
+use Catalyst::Test 'TestApp';
+
+use Data::Dumper;
+
+{
+    my $response = request('/foo');
+    ok( $response->content =~ /foofoofoo/ );
+}
+
+{
+    my $response = request('/foo/bar');
+    ok( $response->content =~ /foobarfoobarfoobar/ );
+}