Lines 24-29
use t::lib::Mocks;
Link Here
|
24 |
use File::Temp qw/tempfile/; |
24 |
use File::Temp qw/tempfile/; |
25 |
use Test::More tests => 1; |
25 |
use Test::More tests => 1; |
26 |
use Test::Warn; |
26 |
use Test::Warn; |
|
|
27 |
use Test::Exception; |
27 |
|
28 |
|
28 |
subtest 'Test01 -- Simple tests for Koha::Logger' => sub { |
29 |
subtest 'Test01 -- Simple tests for Koha::Logger' => sub { |
29 |
plan tests => 10; |
30 |
plan tests => 10; |
Lines 31-38
subtest 'Test01 -- Simple tests for Koha::Logger' => sub {
Link Here
|
31 |
my $ret; |
32 |
my $ret; |
32 |
t::lib::Mocks::mock_config('log4perl_conf', undef); |
33 |
t::lib::Mocks::mock_config('log4perl_conf', undef); |
33 |
|
34 |
|
34 |
eval { Koha::Logger->get }; |
35 |
throws_ok { Koha::Logger->get } qr/Configuration not defined/, 'Logger did not init correctly without config'; |
35 |
ok( $@, 'Logger did not init correctly without config'); |
|
|
36 |
|
36 |
|
37 |
my $log = mytempfile(); |
37 |
my $log = mytempfile(); |
38 |
my $config_file = mytempfile( <<"HERE" |
38 |
my $config_file = mytempfile( <<"HERE" |
Lines 47-55
HERE
Link Here
|
47 |
|
47 |
|
48 |
t::lib::Mocks::mock_config('log4perl_conf', $config_file); |
48 |
t::lib::Mocks::mock_config('log4perl_conf', $config_file); |
49 |
|
49 |
|
50 |
system("chmod 400 $log"); |
50 |
system("chmod 000 $log"); |
51 |
eval { Koha::Logger->get }; |
51 |
throws_ok { Koha::Logger->get } qr/Permission denied/, 'Logger did not init correctly without permission'; |
52 |
ok( $@, 'Logger did not init correctly without permission'); |
|
|
53 |
|
52 |
|
54 |
system("chmod 700 $log"); |
53 |
system("chmod 700 $log"); |
55 |
my $logger = Koha::Logger->get( { interface => 'intranet' } ); |
54 |
my $logger = Koha::Logger->get( { interface => 'intranet' } ); |
56 |
- |
|
|