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