Bugzilla – Attachment 154668 Details for
Bug 25393
Create separate 'no automatic renewal before' rule
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25393: Tests - Variable renaming
Bug-25393-Tests---Variable-renaming.patch (text/plain), 9.04 KB, created by
Andrew Fuerste-Henry
on 2023-08-18 15:50:25 UTC
(
hide
)
Description:
Bug 25393: Tests - Variable renaming
Filename:
MIME Type:
Creator:
Andrew Fuerste-Henry
Created:
2023-08-18 15:50:25 UTC
Size:
9.04 KB
patch
obsolete
>From 258351ad7d918e4d0c9df1bf20f440894bc0a2a8 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Wed, 16 Aug 2023 11:27:06 +0000 >Subject: [PATCH] Bug 25393: Tests - Variable renaming > >issue_4 is an auto_renew issue, rename to auto_renew_issue > >Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org> >--- > t/db_dependent/Circulation.t | 40 ++++++++++++++++++------------------ > 1 file changed, 20 insertions(+), 20 deletions(-) > >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 1bcf5c00328..23d49973247 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -840,14 +840,14 @@ subtest "CanBookBeRenewed tests" => sub { > } > ); > >- my $issue_4 = AddIssue( $renewing_borrower_obj->unblessed, $item_4->barcode, undef, undef, undef, undef, { auto_renew => 1 } ); >+ my $auto_renew_issue = AddIssue( $renewing_borrower_obj->unblessed, $item_4->barcode, undef, undef, undef, undef, { auto_renew => 1 } ); > my $info; > ( $renewokay, $error, $info ) = >- CanBookBeRenewed( $renewing_borrower_obj, $issue_4 ); >+ CanBookBeRenewed( $renewing_borrower_obj, $auto_renew_issue ); > is( $renewokay, 0, 'Bug 14101: Cannot renew, renewal is automatic and premature' ); > is( $error, 'auto_too_soon', > 'Bug 14101: Cannot renew, renewal is automatic and premature, "No renewal before" = undef (returned code is auto_too_soon)' ); >- is( $info->{soonest_renew_date} , dt_from_string($issue_4->date_due), "Due date is returned as earliest renewal date when error is 'auto_too_soon'" ); >+ is( $info->{soonest_renew_date} , dt_from_string($auto_renew_issue->date_due), "Due date is returned as earliest renewal date when error is 'auto_too_soon'" ); > AddReserve( > { > branchcode => $branch, >@@ -863,29 +863,29 @@ subtest "CanBookBeRenewed tests" => sub { > found => $found > } > ); >- ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue_4 ); >+ ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $auto_renew_issue ); > is( $renewokay, 0, 'Still should not be able to renew' ); > is( $error, 'on_reserve', 'returned code is on_reserve, reserve checked when not checking for cron' ); >- ( $renewokay, $error, $info ) = CanBookBeRenewed( $renewing_borrower_obj, $issue_4, undef, 1 ); >+ ( $renewokay, $error, $info ) = CanBookBeRenewed( $renewing_borrower_obj, $auto_renew_issue, undef, 1 ); > is( $renewokay, 0, 'Still should not be able to renew' ); > is( $error, 'auto_too_soon', 'returned code is auto_too_soon, reserve not checked when checking for cron' ); >- is( $info->{soonest_renew_date}, dt_from_string($issue_4->date_due), "Due date is returned as earliest renewal date when error is 'auto_too_soon'" ); >- ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue_4, 1 ); >+ is( $info->{soonest_renew_date}, dt_from_string($auto_renew_issue->date_due), "Due date is returned as earliest renewal date when error is 'auto_too_soon'" ); >+ ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $auto_renew_issue, 1 ); > is( $renewokay, 0, 'Still should not be able to renew' ); > is( $error, 'on_reserve', 'returned code is on_reserve, auto_too_soon limit is overridden' ); >- ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue_4, 1, 1 ); >+ ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $auto_renew_issue, 1, 1 ); > is( $renewokay, 0, 'Still should not be able to renew' ); > is( $error, 'on_reserve', 'returned code is on_reserve, auto_too_soon limit is overridden' ); > $dbh->do('UPDATE circulation_rules SET rule_value = 0 where rule_name = "norenewalbefore"'); > Koha::Cache::Memory::Lite->flush(); >- ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue_4, 1 ); >+ ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $auto_renew_issue, 1 ); > is( $renewokay, 0, 'Still should not be able to renew' ); > is( $error, 'on_reserve', 'returned code is on_reserve, auto_renew only happens if not on reserve' ); > ModReserveCancelAll($item_4->itemnumber, $reserving_borrowernumber); > > $renewing_borrower_obj = Koha::Patrons->find($renewing_borrower_obj->borrowernumber); > $renewing_borrower_obj->autorenew_checkouts(0)->store; >- ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue_4 ); >+ ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $auto_renew_issue ); > is( $renewokay, 1, 'No renewal before is undef, but patron opted out of auto_renewal' ); > $renewing_borrower_obj->autorenew_checkouts(1)->store; > >@@ -910,18 +910,18 @@ subtest "CanBookBeRenewed tests" => sub { > # Bug 14101 > # Test premature automatic renewal > ( $renewokay, $error, $info ) = >- CanBookBeRenewed( $renewing_borrower_obj, $issue_4 ); >+ CanBookBeRenewed( $renewing_borrower_obj, $auto_renew_issue ); > is( $renewokay, 0, 'Bug 14101: Cannot renew, renewal is automatic and premature' ); > is( $error, 'auto_too_soon', > 'Bug 14101: Cannot renew, renewal is automatic and premature (returned code is auto_too_soon)' > ); >- is( $info->{soonest_renew_date}, dt_from_string($issue_4->date_due)->subtract( days => 7 ), "Soonest renew date returned when error is 'auto_too_soon'"); >+ is( $info->{soonest_renew_date}, dt_from_string($auto_renew_issue->date_due)->subtract( days => 7 ), "Soonest renew date returned when error is 'auto_too_soon'"); > > $renewing_borrower_obj->autorenew_checkouts(0)->store; >- ( $renewokay, $error, $info ) = CanBookBeRenewed( $renewing_borrower_obj, $issue_4 ); >+ ( $renewokay, $error, $info ) = CanBookBeRenewed( $renewing_borrower_obj, $auto_renew_issue ); > is( $renewokay, 0, 'No renewal before is 7, patron opted out of auto_renewal still cannot renew early' ); > is( $error, 'too_soon', 'Error is too_soon, no auto' ); >- is( $info->{soonest_renew_date}, dt_from_string($issue_4->date_due)->subtract( days => 7 ), "Soonest renew date returned when error is 'too_soon'"); >+ is( $info->{soonest_renew_date}, dt_from_string($auto_renew_issue->date_due)->subtract( days => 7 ), "Soonest renew date returned when error is 'too_soon'"); > $renewing_borrower_obj->autorenew_checkouts(1)->store; > > # Change policy so that loans can only be renewed exactly on due date (0 days prior to due date) >@@ -929,18 +929,18 @@ subtest "CanBookBeRenewed tests" => sub { > $dbh->do(q{UPDATE circulation_rules SET rule_value = '0' WHERE rule_name = 'norenewalbefore'}); > Koha::Cache::Memory::Lite->flush(); > ( $renewokay, $error, $info ) = >- CanBookBeRenewed( $renewing_borrower_obj, $issue_4 ); >+ CanBookBeRenewed( $renewing_borrower_obj, $auto_renew_issue ); > is( $renewokay, 0, 'Bug 14101: Cannot renew, renewal is automatic and premature' ); > is( $error, 'auto_too_soon', > 'Bug 14101: Cannot renew, renewal is automatic and premature, "No renewal before" = 0 (returned code is auto_too_soon)' > ); >- is( $info->{soonest_renew_date}, dt_from_string($issue_4->date_due), "Soonest renew date returned when error is 'auto_too_soon'"); >+ is( $info->{soonest_renew_date}, dt_from_string($auto_renew_issue->date_due), "Soonest renew date returned when error is 'auto_too_soon'"); > > $renewing_borrower_obj->autorenew_checkouts(0)->store; >- ( $renewokay, $error, $info ) = CanBookBeRenewed( $renewing_borrower_obj, $issue_4 ); >+ ( $renewokay, $error, $info ) = CanBookBeRenewed( $renewing_borrower_obj, $auto_renew_issue ); > is( $renewokay, 0, 'No renewal before is 0, patron opted out of auto_renewal still cannot renew early' ); > is( $error, 'too_soon', 'Error is too_soon, no auto' ); >- is( $info->{soonest_renew_date}, dt_from_string($issue_4->date_due), "Soonest renew date returned when error is 'auto_too_soon'"); >+ is( $info->{soonest_renew_date}, dt_from_string($auto_renew_issue->date_due), "Soonest renew date returned when error is 'auto_too_soon'"); > $renewing_borrower_obj->autorenew_checkouts(1)->store; > > # Change policy so that loans can be renewed 99 days prior to the due date >@@ -948,14 +948,14 @@ subtest "CanBookBeRenewed tests" => sub { > $dbh->do(q{UPDATE circulation_rules SET rule_value = '99' WHERE rule_name = 'norenewalbefore'}); > Koha::Cache::Memory::Lite->flush(); > ( $renewokay, $error ) = >- CanBookBeRenewed( $renewing_borrower_obj, $issue_4 ); >+ CanBookBeRenewed( $renewing_borrower_obj, $auto_renew_issue ); > is( $renewokay, 0, 'Bug 14101: Cannot renew, renewal is automatic' ); > is( $error, 'auto_renew', > 'Bug 14101: Cannot renew, renewal is automatic (returned code is auto_renew)' > ); > > $renewing_borrower_obj->autorenew_checkouts(0)->store; >- ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue_4 ); >+ ( $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' ); > $renewing_borrower_obj->autorenew_checkouts(1)->store; > >-- >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 25393
:
154533
|
154534
|
154535
|
154536
|
154537
|
154538
|
154539
|
154540
|
154541
|
154661
|
154662
|
154663
|
154664
|
154665
|
154666
|
154667
|
154668
|
154669
|
155307
|
155308
|
155309
|
155310
|
155311
|
155312
|
155313
|
155314
|
155315
|
156829
|
156830
|
156831
|
156832
|
156833
|
156834
|
156835
|
156836
|
156837
|
156838
|
156839
|
156840