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