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