https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21086
Bug ID: 21086 Summary: Wrong mock of DateTime->now in tests Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Test Suite Assignee: jonathan.dru...@bugs.koha-community.org Reporter: jonathan.dru...@bugs.koha-community.org QA Contact: testo...@bugs.koha-community.org Depends on: 20287, 19705 prove t/db_dependent/DecreaseLoanHighHolds.t t/db_dependent/DecreaseLoanHighHolds.t .. 1/17 Can't locate object method "truncate" via package "80" (perhaps you forgot to load "80"?) at /home/vagrant/kohaclone/C4/Circulation.pm line 3497. What is happening: We mock DateTime->now in the script to avoid the date comparaisons to fail on slow servers (see bug 19705). my $now_value = DateTime->now(); my $mocked_datetime = Test::MockModule->new('DateTime'); $mocked_datetime->mock( 'now', sub { return $now_value; } ); Since bug 20287, we have the following calls: Koha::Patron->store => Koha::Patron::Category->get_expiry_date which does: 221 return $date->add( months => $self->enrolmentperiod, end_of_month => 'limit' ); as enrolmentperiod is generated by t::lib::TestBuilder, it can be quite big, and so the date change from one call to the others. The failure is actually coming from the date becoming > 9999, which is not handled correctly, on purpose, by Koha::DateUtils (infinite) Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19705 [Bug 19705] DecreaseLoanHighHolds.t is still failing randomly https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20287 [Bug 20287] Move AddMember and ModMember to Koha::Patron -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list Koha-bugs@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/