Test uri_for with path = 0
[catagits/Catalyst-Runtime.git] / t / aggregate / unit_utils_env_value.t
1 use strict;
2 use warnings;
3
4 use Test::More tests => 4;
5
6 use Catalyst::Utils;
7
8 ##############################################################################
9 ### No env vars defined
10 ##############################################################################
11 {
12     ok( !Catalyst::Utils::env_value( 'MyApp', 'Key' ),
13         'No env values defined returns false'
14     );
15 }
16
17 ##############################################################################
18 ### App env var defined
19 ##############################################################################
20 {
21     $ENV{'MYAPP2_KEY'} = 'Env value 2';
22     is( Catalyst::Utils::env_value( 'MyApp2', 'Key' ),
23         'Env value 2', 'Got the right value from the application var' );
24 }
25
26 ##############################################################################
27 ### Catalyst env var defined
28 ##############################################################################
29 {
30     $ENV{'CATALYST_KEY'} = 'Env value 3';
31     is( Catalyst::Utils::env_value( 'MyApp3', 'Key' ),
32         'Env value 3', 'Got the right value from the catalyst var' );
33 }
34
35 ##############################################################################
36 ### Catalyst and Application env vars defined
37 ##############################################################################
38 {
39     $ENV{'CATALYST_KEY'} = 'Env value bad';
40     $ENV{'MYAPP4_KEY'}   = 'Env value 4';
41     is( Catalyst::Utils::env_value( 'MyApp4', 'Key' ),
42         'Env value 4', 'Got the right value from the application var' );
43 }
44