Commit | Line | Data |
ffc0b0d8 |
1 | package MockApp; |
2 | |
2a3587a2 |
3 | use Test::More; |
ffc0b0d8 |
4 | use Cwd; |
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 | |
2a3587a2 |
11 | $ENV{ CATALYST_HOME } = cwd . '/t/lib/MockAppConfigLoader'; |
ffc0b0d8 |
12 | |
13 | use_ok( 'Catalyst' ); |
14 | |
15 | __PACKAGE__->config->{ substitutions } = { |
16 | foo => sub { shift; join( '-', @_ ); } |
17 | }; |
18 | |
19 | __PACKAGE__->setup; |
20 | |
663a4f34 |
21 | ok( my $conf = __PACKAGE__->config, 'config loads' ); |
ffc0b0d8 |
22 | is( $conf->{ 'Controller::Foo' }->{ foo }, 'bar' ); |
23 | is( $conf->{ 'Controller::Foo' }->{ new }, 'key' ); |
24 | is( $conf->{ 'Model::Baz' }->{ qux }, 'xyzzy' ); |
25 | is( $conf->{ 'Model::Baz' }->{ another }, 'new key' ); |
26 | is( $conf->{ 'view' }, 'View::TT::New' ); |
27 | is( $conf->{ 'foo_sub' }, 'x-y' ); |
663a4f34 |
28 | is( $conf->{ 'literal_macro' }, '__DATA__', 'literal macro' ); |
ffc0b0d8 |
29 | is( $conf->{ 'Plugin::Zot' }->{ zoot }, 'zooot'); |
2a3587a2 |
30 | |
31 | done_testing; |