X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Funit_core_setup.t;fp=t%2Funit_core_setup.t;h=311320f2925845ee9890eef7168ba4ec40d0a659;hb=0fa676a79aa572c22884b48560683f21f596fe45;hp=0000000000000000000000000000000000000000;hpb=3fb903fd7b2a932d4a124dbb3c364275b665858d;p=catagits%2FCatalyst-Runtime.git diff --git a/t/unit_core_setup.t b/t/unit_core_setup.t new file mode 100644 index 0000000..311320f --- /dev/null +++ b/t/unit_core_setup.t @@ -0,0 +1,48 @@ +use strict; +use warnings; +use Catalyst::Runtime; + +use Test::More tests => 18; + +{ + # Silence the log. + no warnings 'redefine'; + *Catalyst::Log::_send_to_log = sub {}; +} + +TESTDEBUG: { + package MyTestDebug; + use parent qw/Catalyst/; + __PACKAGE__->setup( + '-Debug', + ); +} + +ok my $c = MyTestDebug->new, 'Get debug app object'; +ok my $log = $c->log, 'Get log object'; +isa_ok $log, 'Catalyst::Log', 'It should be a Catalyst::Log object'; +ok !$log->is_warn, 'Warnings should be disabled'; +ok !$log->is_error, 'Errors should be disabled'; +ok !$log->is_fatal, 'Fatal errors should be disabled'; +ok !$log->is_info, 'Info should be disabled'; +ok $log->is_debug, 'Debugging should be enabled'; +can_ok 'MyTestDebug', 'debug'; +ok +MyTestDebug->debug, 'And it should return true'; + + +TESTAPP: { + package MyTestLog; + use parent qw/Catalyst/; + __PACKAGE__->setup( + '-Log=warn,error,fatal' + ); +} + +ok $c = MyTestLog->new, 'Get log app object'; +ok $log = $c->log, 'Get log object'; +isa_ok $log, 'Catalyst::Log', 'It should be a Catalyst::Log object'; +ok $log->is_warn, 'Warnings should be enabled'; +ok $log->is_error, 'Errors should be enabled'; +ok $log->is_fatal, 'Fatal errors should be enabled'; +ok !$log->is_info, 'Info should be disabled'; +ok !$log->is_debug, 'Debugging should be disabled';