Bugzilla – Attachment 162657 Details for
Bug 31427
Automatic renewal errors should come before many other renewal errors
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31427: (follow-up) Unit tests
Bug-31427-follow-up-Unit-tests.patch (text/plain), 3.09 KB, created by
Marcel de Rooy
on 2024-03-01 10:33:16 UTC
(
hide
)
Description:
Bug 31427: (follow-up) Unit tests
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2024-03-01 10:33:16 UTC
Size:
3.09 KB
patch
obsolete
>From ebff20f3713d860fe3448a5a448247190576ceff Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 26 Oct 2023 09:08:04 +0100 >Subject: [PATCH] Bug 31427: (follow-up) Unit tests >Content-Type: text/plain; charset=utf-8 > >This patch adds a unit test for error precidence where autorenewals is >involved. > >It is not comprehensive however, and I'm a little confused by the logic >around cron vs non-cron handling... > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/Circulation.t | 45 +++++++++++++++++++++++++++++++++++- > 1 file changed, 44 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 5095afde73..cd8192f4f6 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -431,7 +431,7 @@ subtest "GetIssuingCharges tests" => sub { > > my ( $reused_itemnumber_1, $reused_itemnumber_2 ); > subtest "CanBookBeRenewed tests" => sub { >- plan tests => 113; >+ plan tests => 114; > > C4::Context->set_preference('ItemsDeniedRenewal',''); > # Generate test biblio >@@ -1011,6 +1011,49 @@ subtest "CanBookBeRenewed tests" => sub { > is( $renewokay, 1, 'No renewal before is 99, patron opted out of auto_renewal so can renew' ); > $renewing_borrower_obj->autorenew_checkouts(1)->store; > >+ >+ # Bug 31427 >+ # Ensure autorenewal errors always take highest precedence >+ subtest "auto_renewal errors first" => sub { >+ plan tests => 4; >+ >+ my $auto_renew_item = $builder->build_sample_item( >+ { >+ biblionumber => $biblio->biblionumber, >+ library => $branch, >+ } >+ ); >+ >+ my $ten_days_ahead = dt_from_string->add( days => 10 ); >+ my $issue = AddIssue( >+ $renewing_borrower_obj, $auto_renew_item->barcode, $ten_days_ahead, undef, undef, undef, >+ { auto_renew => 1 } >+ ); >+ >+ Koha::CirculationRules->set_rules( >+ { >+ categorycode => undef, >+ branchcode => undef, >+ itemtype => undef, >+ rules => { >+ noautorenewalbefore => 7, >+ renewalsallowed => 2, >+ } >+ } >+ ); >+ my ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue, undef, 'cron' ); >+ is( $renewokay, 0, 'Do not renew, renewal is automatic' ); >+ is( $error, 'auto_too_soon', 'Cannot auto renew, too soon - returned code is auto_too_soon' ); >+ >+ $issue->renewals_count(2)->store; >+ ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue, undef, 'cron' ); >+ is( $renewokay, 0, 'Do not renew, renewal is automatic' ); >+ is( >+ $error, 'auto_too_soon', >+ 'Cannot auto renew, too soon - auto renewal error takes precedence over non-autorenewal error too_many' >+ ); >+ }; >+ > subtest "too_late_renewal / no_auto_renewal_after" => sub { > plan tests => 16; > my $item_to_auto_renew = $builder->build_sample_item( >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31427
:
153696
|
153732
|
156232
|
157894
|
162239
|
162240
|
162656
| 162657 |
162658