From 5bcdcae9f6c0e4d27258d0d86c83e1313ccda3c5 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 --- 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 7cd2c0d74f..9ce1732816 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -5278,6 +5278,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"' + ); }; $schema->storage->txn_rollback; -- 2.30.2