Commit | Line | Data |
d1b52b01 |
1 | use Test::More tests => 6;\r |
79b66c82 |
2 | \r |
3 | my $app = MockApp->new;\r |
4 | $app->setup;\r |
5 | \r |
6 | ok( $app->config );\r |
7 | is( $app->config->{ 'Controller::Foo' }->{ foo }, 'bar' );\r |
8 | is( $app->config->{ 'Controller::Foo' }->{ new }, 'key' );\r |
9 | is( $app->config->{ 'Model::Baz' }->{ qux }, 'xyzzy' );\r |
10 | is( $app->config->{ 'Model::Baz' }->{ another }, 'new key' );\r |
d1b52b01 |
11 | is( $app->config->{ 'view' }, 'View::TT::New' );\r |
79b66c82 |
12 | \r |
13 | package MockApp;\r |
14 | \r |
15 | use base qw( Catalyst::Plugin::ConfigLoader );\r |
16 | use NEXT;\r |
17 | use Catalyst::Utils;\r |
18 | \r |
19 | sub new {\r |
20 | return bless { }, shift;\r |
21 | }\r |
22 | \r |
23 | sub path_to {\r |
24 | return 't/mockapp';\r |
25 | }\r |
26 | \r |
27 | sub debug {\r |
28 | 0;\r |
29 | }\r |
30 | \r |
31 | sub config {\r |
32 | my $self = shift;\r |
33 | $self->{ _config } = {} unless $self->{ _config };\r |
34 | if (@_) {\r |
35 | my $config = @_ > 1 ? {@_} : $_[0];\r |
36 | while ( my ( $key, $val ) = each %$config ) {\r |
37 | $self->{ _config }->{$key} = $val;\r |
38 | }\r |
39 | }\r |
40 | return $self->{ _config };\r |
41 | }\r |
42 | \r |
43 | 1; |