Bug 22446 - Koha/Patron/Categories.t is failing on March 1st (2019 only?) and Feb 29th 2024
Summary: Koha/Patron/Categories.t is failing on March 1st (2019 only?) and Feb 29th 2024
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal
Assignee: Chris Cormack
QA Contact: Testopia
URL:
Keywords:
: 22443 33107 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-03-02 00:35 UTC by Jonathan Druart
Modified: 2024-02-29 12:42 UTC (History)
1 user (show)

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


Attachments
Bug 22446: Add tests to highlight the problem (4.23 KB, patch)
2019-03-02 17:37 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22446: Explicitely list what we expect to avoid ambiguity (3.05 KB, patch)
2019-03-04 16:19 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2019-03-02 00:35:52 UTC
koha_1       |     #   Failed test 'With enrolmentperiod defined and a date given in parameter, ->get_expiry_date should take this date + enrolmentperiod'
koha_1       |     #   at t/db_dependent/Koha/Patron/Categories.t line 80.
koha_1       |     #          got: '-1'
koha_1       |     #     expected: '0'
koha_1       |     # Looks like you failed 1 test of 5.
koha_1       | 
koha_1       | #   Failed test 'get_expiry_date'
koha_1       | #   at t/db_dependent/Koha/Patron/Categories.t line 86.
Comment 1 Jonathan Druart 2019-03-02 17:37:05 UTC
Created attachment 85952 [details] [review]
Bug 22446: Add tests to highlight the problem
Comment 2 Jonathan Druart 2019-03-04 16:19:20 UTC
Created attachment 86011 [details] [review]
Bug 22446: Explicitely list what we expect to avoid ambiguity
Comment 3 Jonathan Druart 2019-03-04 16:20:04 UTC
This is a duplicate of bug 22443. However here I suspect a bug in ->get_expiry_date, not a calculation problem in tests.
Comment 4 Martin Renvoize (ashimema) 2019-03-05 14:26:32 UTC
Comment on attachment 86011 [details] [review]
Bug 22446: Explicitely list what we expect to avoid ambiguity

Review of attachment 86011 [details] [review]:
-----------------------------------------------------------------

::: t/db_dependent/Koha/Patron/Categories.t
@@ +110,3 @@
>              Time::Fake->offset( $dt->epoch );
>  
> +            my $next_month = dt_from_string($date->{next_month}, 'iso');

I think I found that $next_month was not actually used anywhere.. be nice to do a little housekeeping whilst in here.
Comment 5 Martin Renvoize (ashimema) 2019-03-05 14:28:28 UTC
I actually prefer hard-coding these dates for tests as you have done here.. our Koha code relies on DateTime maths so by relying on the same DateTime maths in the test we were realistically just testing DateTime against DateTime so wouldn't have picked up breaking changes in the parent library.
Comment 6 Martin Renvoize (ashimema) 2019-03-05 14:29:10 UTC
*** Bug 22443 has been marked as a duplicate of this bug. ***
Comment 7 Jonathan Druart 2024-02-29 12:41:03 UTC
*** Bug 33107 has been marked as a duplicate of this bug. ***
Comment 8 Jonathan Druart 2024-02-29 12:41:38 UTC
Today, Feb 29th 2024

t/db_dependent/Koha/Patron/Categories.t .. 1/10 
    #   Failed test 'With enrolmentperiod defined and no parameter, ->get_expiry_date should return today + enrolmentperiod'
    #   at t/db_dependent/Koha/Patron/Categories.t line 88.
    #          got: '-1'
    #     expected: '0'
    # Looks like you failed 1 test of 7.

#   Failed test 'get_expiry_date'
#   at t/db_dependent/Koha/Patron/Categories.t line 103.


t/db_dependent/Koha/Patrons/Import.t .. 176/178 
    #   Failed test 'Expiration date is correct with update_dateexpiry = true no dateexpiry in file and update_dateexpiryfromtoday false (i.e. use passed dateenrolled) '
    #   at t/db_dependent/Koha/Patrons/Import.t line 1202.
    #          got: '2025-08-28'
    #     expected: '2025-08-29'
    # Looks like you failed 1 test of 3.

#   Failed test 'test update_dateexpiry when no dateexpiry in file'
#   at t/db_dependent/Koha/Patrons/Import.t line 1234.