Bug 25621 - Some tests in t/DateUtils.t fail when timezone is not UTC
Summary: Some tests in t/DateUtils.t fail when timezone is not UTC
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Julian Maurice
QA Contact: Testopia
URL:
Keywords:
Depends on: 18330
Blocks:
  Show dependency treegraph
 
Reported: 2020-05-29 09:03 UTC by Julian Maurice
Modified: 2023-08-08 12:36 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 25621: Fix DateUtils tests when timezone is not UTC (688 bytes, patch)
2020-05-29 09:06 UTC, Julian Maurice
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Julian Maurice 2020-05-29 09:03:48 UTC
To reproduce:
1. Verify that TZ environment variable is not defined
2. Verify that $KOHA_CONF does not contain <timezone>
3. Run `date` to verify that you have a local time different than UTC
4. prove t/DateUtils.t

Expected output:
% prove t/DateUtils.t
t/DateUtils.t .. 1/76
#   Failed test 'dt_from_string handles seconds with 1 decimal place'
#   at t/DateUtils.t line 130.
#          got: '1325447940'
#     expected: '1325462340'

#   Failed test 'dt_from_string handles seconds with 2 decimal places'
#   at t/DateUtils.t line 133.
#          got: '1325447940'
#     expected: '1325462340'

#   Failed test 'dt_from_string handles seconds with 3 decimal places'
#   at t/DateUtils.t line 136.
#          got: '1325447999'
#     expected: '1325462399'

#   Failed test 'dt_from_string handles seconds with 3 decimal places and a timezone'
#   at t/DateUtils.t line 139.
#          got: '1325447999'
#     expected: '1325462399'
# Looks like you failed 4 tests of 76.
Comment 1 Julian Maurice 2020-05-29 09:06:05 UTC
Created attachment 105433 [details] [review]
Bug 25621: Fix DateUtils tests when timezone is not UTC
Comment 2 Jonathan Druart 2020-05-29 09:24:59 UTC
There is a bug in Koha::DateUtils, the timezone should not make the tests fail.
Comment 3 Marcel de Rooy 2023-08-08 12:35:48 UTC
Added the mock_config line in another test to see if it would resolve a similar problem with time zones. But it did not..