ignore non-ref model/view/controller/component keys
[catagits/Catalyst-Plugin-ConfigLoader.git] / t / 20-mock_load.t
CommitLineData
d1b52b01 1use Test::More tests => 6;\r
79b66c82 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
d1b52b01 11is( $app->config->{ 'view' }, 'View::TT::New' );\r
79b66c82 12\r
13package MockApp;\r
14\r
15use base qw( Catalyst::Plugin::ConfigLoader );\r
16use NEXT;\r
17use Catalyst::Utils;\r
18\r
19sub new {\r
20 return bless { }, shift;\r
21}\r
22\r
23sub path_to {\r
24 return 't/mockapp';\r
25}\r
26\r
27sub debug {\r
28 0;\r
29}\r
30\r
31sub 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
431;