4 use Test::More tests => 30;
11 warn("Setting up mock application: $name\n");
12 my $meta = Moose->init_meta( for_class => $name );
13 $meta->superclasses('Catalyst');
18 my ($log, %expected) = @_;
19 foreach my $level (keys %expected) {
20 my $method_name = "is_$level";
21 if ($expected{$level}) {
22 ok( $log->$method_name(), "Level $level on" );
25 ok( !$log->$method_name(), "Level $level off" );
30 local %ENV; # Ensure blank or someone, somewhere will fail..
33 my $app = mock_app('TestLogAppParseLevels');
34 $app->setup_log('error,warn');
35 ok !$app->debug, 'Not in debug mode';
36 test_log_object($app->log,
37 fatal => 0, # WTF - I thought log levels were additive these days,
38 # or do I not understand the patch which pupported to make
47 local %ENV = ( CATALYST_DEBUG => 1 );
48 my $app = mock_app('TestLogAppDebugEnvSet');
50 ok $app->debug, 'In debug mode';
51 test_log_object($app->log,
60 local %ENV = ( CATALYST_DEBUG => 0 );
61 my $app = mock_app('TestLogAppDebugEnvUnset');
62 $app->setup_log('warn');
63 ok !$app->debug, 'Not In debug mode';
64 test_log_object($app->log,
73 my $app = mock_app('TestLogAppEmptyString');
75 ok !$app->debug, 'Not In debug mode';
76 test_log_object($app->log,
85 my $app = mock_app('TestLogAppDebugOnly');
86 $app->setup_log('debug');
87 ok $app->debug, 'In debug mode';
88 test_log_object($app->log,