Bugzilla – Attachment 142071 Details for
Bug 31095
Remove Koha::Patron::Debarment::GetDebarments and use $patron->restrictions in preference
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31095: Remove GetDebarments from maxsuspensiondays.t
Bug-31095-Remove-GetDebarments-from-maxsuspensiond.patch (text/plain), 3.23 KB, created by
Martin Renvoize (ashimema)
on 2022-10-18 14:09:32 UTC
(
hide
)
Description:
Bug 31095: Remove GetDebarments from maxsuspensiondays.t
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-10-18 14:09:32 UTC
Size:
3.23 KB
patch
obsolete
>From ba76d5e3df037d080b6d73938135fa4d95011aee Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 25 Aug 2022 09:00:51 +0100 >Subject: [PATCH] Bug 31095: Remove GetDebarments from maxsuspensiondays.t > >This patch replaces GetDebarments in maxsuspensiondays.t with calls to >the restrictions accessor. > >Test plan >1. Confirm t/db_dependent/Circulation/maxsuspensiondays.t passes prior > to this patch >2. Confirm t/db_dependent/Circulation/maxsuspensiondays.t passes after > this patch >3. Confirm no tests have been removed in this patch > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > .../Circulation/maxsuspensiondays.t | 19 +++++++++++-------- > 1 file changed, 11 insertions(+), 8 deletions(-) > >diff --git a/t/db_dependent/Circulation/maxsuspensiondays.t b/t/db_dependent/Circulation/maxsuspensiondays.t >index 0660b27415..94311487d1 100755 >--- a/t/db_dependent/Circulation/maxsuspensiondays.t >+++ b/t/db_dependent/Circulation/maxsuspensiondays.t >@@ -9,7 +9,7 @@ use C4::Circulation qw( AddIssue AddReturn ); > use C4::Biblio qw( AddBiblio ); > use Koha::Database; > use Koha::DateUtils qw( dt_from_string output_pref ); >-use Koha::Patron::Debarments qw( GetDebarments DelDebarment ); >+use Koha::Patron::Debarments qw( DelDebarment ); > use Koha::Patrons; > > use t::lib::TestBuilder; >@@ -48,7 +48,8 @@ my $borrowernumber = Koha::Patron->new({ > categorycode => $patron_category->{categorycode}, > branchcode => $branchcode, > })->store->borrowernumber; >-my $borrower = Koha::Patrons->find( $borrowernumber )->unblessed; >+my $patron_object = Koha::Patrons->find( $borrowernumber ); >+my $borrower = $patron_object->unblessed; > > my $record = MARC::Record->new(); > $record->append_fields( >@@ -76,13 +77,14 @@ my $daysafter40 = dt_from_string->add_duration(DateTime::Duration->new(days => 4 > > AddIssue( $borrower, $barcode, $daysago20 ); > AddReturn( $barcode, $branchcode ); >-my $debarments = GetDebarments({borrowernumber => $borrower->{borrowernumber}}); >+my $debarments = $patron_object->restrictions; >+my $THE_debarment = $debarments->next; > is( >- $debarments->[0]->{expiration}, >+ $THE_debarment->expiration, > output_pref({ dt => $daysafter40, dateformat => 'iso', dateonly => 1 }), > 'calculate suspension with no maximum set' > ); >-DelDebarment( $debarments->[0]->{borrower_debarment_id} ); >+DelDebarment( $THE_debarment->borrower_debarment_id ); > > # Test with maxsuspensiondays = 10 days > Koha::CirculationRules->set_rules( >@@ -99,13 +101,14 @@ Koha::CirculationRules->set_rules( > my $daysafter10 = dt_from_string->add_duration(DateTime::Duration->new(days => 10)); > AddIssue( $borrower, $barcode, $daysago20 ); > AddReturn( $barcode, $branchcode ); >-$debarments = GetDebarments({borrowernumber => $borrower->{borrowernumber}}); >+$debarments = $patron_object->restrictions; >+$THE_debarment = $debarments->next; > is( >- $debarments->[0]->{expiration}, >+ $THE_debarment->expiration, > output_pref({ dt => $daysafter10, dateformat => 'iso', dateonly => 1 }), > 'calculate suspension with a maximum set' > ); >-DelDebarment( $debarments->[0]->{borrower_debarment_id} ); >+DelDebarment( $THE_debarment->borrower_debarment_id ); > > subtest "suspension_chargeperiod" => sub { > Koha::CirculationRules->set_rules( >-- >2.20.1
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 31095
:
139614
|
139719
|
139720
|
139721
|
139722
|
139723
|
139724
|
139725
|
139726
|
139727
|
139728
|
139742
|
139743
|
139744
|
139745
|
139746
|
139747
|
139748
|
139749
|
139750
|
139751
|
139752
|
139753
|
139754
|
139755
|
139756
|
139757
|
139758
|
140714
|
140715
|
140716
|
140717
|
140718
|
140719
|
140720
|
140721
|
140722
|
140723
|
140724
|
140725
|
140726
|
140727
|
140728
|
140729
|
140730
|
140731
|
142059
|
142060
|
142061
|
142062
|
142063
|
142064
|
142065
|
142066
|
142067
|
142068
|
142069
|
142070
|
142071
|
142072
|
142073
|
142074
|
142075
|
142076
|
143745
|
143746
|
143747
|
143748
|
143749
|
143750
|
143751
|
143752
|
143753
|
143754
|
143755
|
143756
|
143757
|
143758
|
143759
|
143760
|
143761
|
143762
|
143763
|
144903
|
144904
|
144905
|
144906
|
144907
|
144908
|
144909
|
144910
|
144911
|
144912
|
144913
|
144914
|
144915
|
144916
|
144917
|
144918
|
144919
|
144920
|
144921
|
145800
|
145801
|
145803
|
145845