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.
Created attachment 85952 [details] [review] Bug 22446: Add tests to highlight the problem
Created attachment 86011 [details] [review] Bug 22446: Explicitely list what we expect to avoid ambiguity
This is a duplicate of bug 22443. However here I suspect a bug in ->get_expiry_date, not a calculation problem in tests.
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.
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.
*** Bug 22443 has been marked as a duplicate of this bug. ***
*** Bug 33107 has been marked as a duplicate of this bug. ***
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.