3e194deaff5a3de96e8afc1fecbb356f0ccdf7e2
[catagits/Catalyst-Runtime.git] / t / 14beginend.t
1 package TestApp;
2
3 use Catalyst qw[-Engine=Test];
4
5
6 sub begin : Private { 
7     my ( $self, $c ) = @_;
8     $c->res->output('foo');
9 }
10
11 sub default : Private { }
12
13 sub end : Private { 
14     my ( $self, $c ) = @_;
15     $c->res->output( $c->res->output . 'bar' );
16 }
17
18
19 __PACKAGE__->setup;
20
21 package TestApp::C::Foo::Bar;
22
23 use base 'Catalyst::Base';
24
25 sub begin : Private { 
26     my ( $self, $c ) = @_;
27     $c->res->output('yada');
28 }
29
30 sub default : Private { }
31
32 sub end : Private { 
33     my ( $self, $c ) = @_;
34     $c->res->output( $c->res->output . 'yada' );
35 }
36
37 package main;
38
39 use Test::More tests => 2;
40 use Catalyst::Test 'TestApp';
41
42 ok( get('/foo')         =~ /foobar/ );
43 ok( get('/foo/bar/foo') =~ /yadayada/ );