Bug 22008: Add tests for new constraints
[koha.git] / t / timezones.t
index c5463da..ee64438 100644 (file)
@@ -2,9 +2,12 @@ use Modern::Perl;
 
 use C4::Context;
 
-use Test::More tests => 3;
+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',
@@ -23,3 +26,9 @@ is(
     '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';