Commit | Line | Data |
a7afecf7 |
1 | package MockApp; |
2 | |
25cd1420 |
3 | use Test::More tests => 10; |
a7afecf7 |
4 | use Cwd; |
64443e1a |
5 | |
6 | # Remove all relevant env variables to avoid accidental fail |
7 | foreach my $name ( grep { m{^(CATALYST)} } keys %ENV ) { |
8 | delete $ENV{ $name }; |
9 | } |
10 | |
a7afecf7 |
11 | $ENV{ CATALYST_HOME } = cwd . '/t/mockapp'; |
12 | |
13 | use_ok( 'Catalyst', qw( ConfigLoader ) ); |
14 | |
af391898 |
15 | __PACKAGE__->config->{ 'Plugin::ConfigLoader' }->{ substitutions } = { |
587d381b |
16 | foo => sub { shift; join( '-', @_ ); } |
d392c48d |
17 | }; |
18 | |
a7afecf7 |
19 | __PACKAGE__->setup; |
20 | |
a7afecf7 |
21 | ok( __PACKAGE__->config ); |
22 | is( __PACKAGE__->config->{ 'Controller::Foo' }->{ foo }, 'bar' ); |
23 | is( __PACKAGE__->config->{ 'Controller::Foo' }->{ new }, 'key' ); |
587d381b |
24 | is( __PACKAGE__->config->{ 'Model::Baz' }->{ qux }, 'xyzzy' ); |
25 | is( __PACKAGE__->config->{ 'Model::Baz' }->{ another }, 'new key' ); |
26 | is( __PACKAGE__->config->{ 'view' }, 'View::TT::New' ); |
27 | is( __PACKAGE__->config->{ 'foo_sub' }, 'x-y' ); |
28 | is( __PACKAGE__->config->{ 'literal_macro' }, '__DATA__' ); |
25cd1420 |
29 | is( __PACKAGE__->config->{ 'Plugin::Zot' }->{ zoot }, 'zooot'); |