From a41958999886cd72899a432809adf45a104986e2 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 25 Mar 2022 15:18:27 +0000 Subject: [PATCH] Bug 30362: Unit test Signed-off-by: Sam Lau Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 145788398ab6ef606bb9cb86a4783577b6f2d234) Signed-off-by: Fridolin Somers --- t/db_dependent/Circulation.t | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index 5c91fb195b..2ac1d43bcc 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -5757,6 +5757,23 @@ subtest "GetSoonestRenewDate tests" => sub { $datedue, 'Checkouts with auto-renewal can be renewed earliest on due date if no renewalbefore' ); + + t::lib::Mocks::mock_preference( 'NoRenewalBeforePrecision', 'date' ); + Koha::CirculationRules->set_rule( + { + categorycode => undef, + branchcode => undef, + itemtype => undef, + rule_name => 'norenewalbefore', + rule_value => 1, + } + ); + $issue->date_due( dt_from_string )->store; + is( + GetSoonestRenewDate( $patron->id, $item->itemnumber ), + dt_from_string->truncate( to => 'day' ), + 'Checkouts with auto-renewal can be renewed 1 day before due date if no renewalbefore = 1 and precision = "date"' + ); }; subtest "CanBookBeIssued + needsconfirmation message" => sub { -- 2.39.2