5 use Test::More tests => 20;
9 no warnings 'redefine';
10 *Catalyst::Log::_send_to_log = sub {};
15 use base qw/Catalyst/;
21 ok my $c = MyTestDebug->new, 'Get debug app object';
22 ok my $log = $c->log, 'Get log object';
23 isa_ok $log, 'Catalyst::Log', 'It should be a Catalyst::Log object';
24 ok !$log->is_warn, 'Warnings should be disabled';
25 ok !$log->is_error, 'Errors should be disabled';
26 ok !$log->is_fatal, 'Fatal errors should be disabled';
27 ok !$log->is_info, 'Info should be disabled';
28 ok $log->is_debug, 'Debugging should be enabled';
29 can_ok 'MyTestDebug', 'debug';
30 ok +MyTestDebug->debug, 'And it should return true';
35 use base qw/Catalyst/;
37 '-Log=warn,error,fatal'
41 ok $c = MyTestLog->new, 'Get log app object';
42 ok $log = $c->log, 'Get log object';
43 isa_ok $log, 'Catalyst::Log', 'It should be a Catalyst::Log object';
44 ok $log->is_warn, 'Warnings should be enabled';
45 ok $log->is_error, 'Errors should be enabled';
46 ok $log->is_fatal, 'Fatal errors should be enabled';
47 ok !$log->is_info, 'Info should be disabled';
48 ok !$log->is_debug, 'Debugging should be disabled';
51 package MyTestAppWithOwnLogger;
52 use base qw/Catalyst/;
54 my $log = Test::MockObject->new;
55 $log->set_false(qw/debug error fatal info warn/);
56 __PACKAGE__->log($log);
57 __PACKAGE__->setup('-Debug');
60 ok $c = MyTestAppWithOwnLogger->new, 'Get with own logger app object';
61 ok $c->debug, '$c->debug is true';