From 8bd50acd17a5b41cb2c1859a51131d56c7ecff70 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 (cherry picked from commit a41958999886cd72899a432809adf45a104986e2) Signed-off-by: Matt Blenkinsop --- 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 072ec5e8cc..4a59c1db0a 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -5764,6 +5764,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