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