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 <david@davidnind.com>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Lari Taskula 2026-04-07 16:22:38 +03:00 committed by Lucas Gass
parent d72439dc89
commit 5fa5012ebe
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 9 additions and 1 deletions

View File

@ -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' );