From 5fa5012ebe76cc655f95fdc8d0648b24a432cf28 Mon Sep 17 00:00:00 2001 From: Lari Taskula Date: Tue, 7 Apr 2026 16:22:38 +0300 Subject: [PATCH] Bug 42298: Add a failing test To test: 1. prove t/db_dependent/Circulation.t 2. Observe the following failures t/db_dependent/Circulation.t .. 17/87 # Failed test 'Bug 42298: No autorenew before rule is respected' # at t/db_dependent/Circulation.t line 1134. # got: '0' # expected: '1' # Failed test 'Bug 42298: No autorenew before rule is respected' # at t/db_dependent/Circulation.t line 1135. # got: 'too_soon' # expected: 'auto_renew' # Failed test 'soonest_renew_date is not returned because this issue can be renewed' # at t/db_dependent/Circulation.t line 1136. # got: '2026-04-21T23:59:00' # expected: undef # Failed test 'No renewal before is 99, patron opted out of auto_renewal so can renew' # at t/db_dependent/Circulation.t line 1141. # got: '0' # expected: '1' # Looks like you failed 4 tests of 124. Signed-off-by: David Nind Signed-off-by: Laura_Escamilla Signed-off-by: Lucas Gass --- t/db_dependent/Circulation.t | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index 0a4f2b5237..7c21cd95b3 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -497,7 +497,7 @@ subtest "GetIssuingCharges tests" => sub { my ( $reused_itemnumber_1, $reused_itemnumber_2 ); subtest "CanBookBeRenewed tests" => sub { - plan tests => 121; + plan tests => 124; C4::Context->set_preference( 'ItemsDeniedRenewal', '' ); @@ -1127,6 +1127,14 @@ subtest "CanBookBeRenewed tests" => sub { is( $error, 'auto_renew', 'Bug 25393: Can auto renew' ); is( $info->{soonest_renew_date}, undef, "soonest_renew_date is not returned because this issue can be renewed" ); + $dbh->do(q{UPDATE circulation_rules SET rule_value = '1' WHERE rule_name = 'norenewalbefore'}); + Koha::Cache::Memory::Lite->flush(); + ( $renewokay, $error, $info ) = CanBookBeRenewed( $renewing_borrower_obj, $auto_renew_issue, undef, 1 ); + is( $renewokay, 1, 'Bug 42298: No autorenew before rule is respected' ); + is( $error, 'auto_renew', 'Bug 42298: No autorenew before rule is respected' ); + is( $info->{soonest_renew_date}, undef, "soonest_renew_date is not returned because this issue can be renewed" ); + $dbh->do(q{UPDATE circulation_rules SET rule_value = '99' WHERE rule_name = 'norenewalbefore'}); + $renewing_borrower_obj->autorenew_checkouts(0)->store; ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $auto_renew_issue ); is( $renewokay, 1, 'No renewal before is 99, patron opted out of auto_renewal so can renew' );