Bug 32979: Add Test::Exception to Logger.t
Test plan: Run t/Logger.t Note: Run under koha user, not root. Root wont have the permission failure which is tested. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> (cherry picked from commit2cdc018c81) (cherry picked from commit1575f81c8b) Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> (cherry picked from commit06cbe54392) Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
This commit is contained in:
parent
0be59969ff
commit
8bbba0bfaa
|
|
@ -24,6 +24,7 @@ use t::lib::Mocks;
|
|||
use File::Temp qw/tempfile/;
|
||||
use Test::More tests => 1;
|
||||
use Test::Warn;
|
||||
use Test::Exception;
|
||||
|
||||
subtest 'Test01 -- Simple tests for Koha::Logger' => sub {
|
||||
plan tests => 10;
|
||||
|
|
@ -31,8 +32,7 @@ subtest 'Test01 -- Simple tests for Koha::Logger' => sub {
|
|||
my $ret;
|
||||
t::lib::Mocks::mock_config('log4perl_conf', undef);
|
||||
|
||||
eval { Koha::Logger->get };
|
||||
ok( $@, 'Logger did not init correctly without config');
|
||||
throws_ok { Koha::Logger->get } qr/Configuration not defined/, 'Logger did not init correctly without config';
|
||||
|
||||
my $log = mytempfile();
|
||||
my $config_file = mytempfile( <<"HERE"
|
||||
|
|
@ -48,8 +48,7 @@ HERE
|
|||
t::lib::Mocks::mock_config('log4perl_conf', $config_file);
|
||||
|
||||
system("chmod 400 $log");
|
||||
eval { Koha::Logger->get };
|
||||
ok( $@, 'Logger did not init correctly without permission');
|
||||
throws_ok { Koha::Logger->get } qr/Permission denied/, 'Logger did not init correctly without permission';
|
||||
|
||||
system("chmod 700 $log");
|
||||
my $logger = Koha::Logger->get( { interface => 'intranet' } );
|
||||
|
|
|
|||
Loading…
Reference in New Issue