updated the test
[catagits/Catalyst-Runtime.git] / t / aggregate / unit_core_container_mock_load_env.t
CommitLineData
4b22d4c6 1package MockAppEnv;
ffc0b0d8 2
2a3587a2 3use Test::More;
ffc0b0d8 4use Cwd;
5
6# Remove all relevant env variables to avoid accidental fail
2a3587a2 7foreach my $name ( grep { m{^(CATALYST|MOCKAPPENV)} } keys %ENV ) {
8 delete $ENV{ $name };
9}
ffc0b0d8 10
2a3587a2 11$ENV{ CATALYST_HOME } = cwd . '/t/lib/MockAppConfigLoader';
12$ENV{ MOCKAPPENV_CONFIG } = $ENV{ CATALYST_HOME } . '/mockapp.pl';
ffc0b0d8 13
2a3587a2 14use_ok( 'Catalyst' );
ffc0b0d8 15
2a3587a2 16__PACKAGE__->config->{substitutions} = {
17 foo => sub { shift; join( '-', @_ ); }
18};
ffc0b0d8 19
2a3587a2 20__PACKAGE__->setup;
ffc0b0d8 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' );
2a3587a2 31
32done_testing;