more test description
[catagits/Catalyst-Runtime.git] / t / aggregate / unit_core_container_mock_load_env.t
CommitLineData
ffc0b0d8 1package MockApp;
2
3use Test::More tests => 10;
4use Cwd;
5
6# Remove all relevant env variables to avoid accidental fail
7foreach 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
14use_ok( 'Catalyst' );
15
16__PACKAGE__->config->{substitutions} = {
17 foo => sub { shift; join( '-', @_ ); }
18};
19
20__PACKAGE__->setup;
21
663a4f34 22ok( my $conf = __PACKAGE__->config, 'config loads' );
ffc0b0d8 23is( $conf->{ 'Controller::Foo' }->{ foo }, 'bar' );
24is( $conf->{ 'Controller::Foo' }->{ new }, 'key' );
25is( $conf->{ 'Model::Baz' }->{ qux }, 'xyzzy' );
26is( $conf->{ 'Model::Baz' }->{ another }, 'new key' );
27is( $conf->{ 'view' }, 'View::TT::New' );
28is( $conf->{ 'foo_sub' }, 'x-y' );
663a4f34 29is( $conf->{ 'literal_macro' }, '__DATA__', 'literal macro' );
30is( $conf->{ 'environment_macro' }, $ENV{ CATALYST_HOME }.'/mockapp.pl', 'environment macro' );