Koha/t/timezones.t
Jonathan Druart f1f9c6dc74 Bug 26384: Fix executable flags
.pm must not have -x
.t must have -x
.pl must have -x

Test plan:
Apply only the first patch, run the tests and confirm that the failures
make sense
Apply this patch and confirm that the test now returns green

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-09-11 09:56:56 +02:00

34 lines
885 B
Raku
Executable file

use Modern::Perl;
use C4::Context;
use Test::More tests => 5;
use Test::Warn;
use t::lib::Mocks;
use DateTime::TimeZone;
$ENV{TZ} = q{};
t::lib::Mocks::mock_config( 'timezone', q{} );
is( C4::Context->timezone, 'local',
'Got local timezone with no env or config timezone set' );
$ENV{TZ} = 'Antarctica/Macquarie';
is(
C4::Context->timezone,
'Antarctica/Macquarie',
'Got correct timezone using ENV, overrides local time'
);
t::lib::Mocks::mock_config( 'timezone', 'Antarctica/South_Pole' );
is(
C4::Context->timezone,
'Antarctica/South_Pole',
'Got correct timezone using config, overrides env'
);
t::lib::Mocks::mock_config( 'timezone', 'Your/Timezone' );
warning_is {
is( C4::Context->timezone, 'local', 'Invalid timezone falls back to local' ); }
'Invalid timezone in koha-conf.xml (Your/Timezone)',
'Invalid timezone raises a warning';