Bugzilla – Attachment 176777 Details for
Bug 37418
Expand delete_patron.pl / Patrons with defined restrictions should not be deleted
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37418: (follow-up) Add unit tests for GetBorrowersToExpunge()
Bug-37418-follow-up-Add-unit-tests-for-GetBorrower.patch (text/plain), 2.48 KB, created by
Raphael Straub
on 2025-01-20 10:08:53 UTC
(
hide
)
Description:
Bug 37418: (follow-up) Add unit tests for GetBorrowersToExpunge()
Filename:
MIME Type:
Creator:
Raphael Straub
Created:
2025-01-20 10:08:53 UTC
Size:
2.48 KB
patch
obsolete
>From c375ccb3a006bd37ab35a29ceb68439ebc85f4d2 Mon Sep 17 00:00:00 2001 >From: Raphael Straub <raphael.straub@kit.edu> >Date: Mon, 20 Jan 2025 09:57:53 +0000 >Subject: [PATCH] Bug 37418: (follow-up) Add unit tests for > GetBorrowersToExpunge() > >Add unit tests for testing the new parameter without_restriction_types >of C4::Members::GetBorrowersToExpunge(). > >Sponsored-by: Karlsruhe Institute of Technology (KIT) >--- > t/db_dependent/Members.t | 33 ++++++++++++++++++++++++++++++++- > 1 file changed, 32 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Members.t b/t/db_dependent/Members.t >index 8b4c38fd54..c2c0bd11e3 100755 >--- a/t/db_dependent/Members.t >+++ b/t/db_dependent/Members.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 50; >+use Test::More tests => 52; > use Test::MockModule; > use Test::Exception; > >@@ -27,6 +27,7 @@ use Koha::Database; > use Koha::Holds; > use Koha::List::Patron qw( AddPatronList AddPatronsToList ); > use Koha::Patrons; >+use Koha::Patron::Debarments qw( AddDebarment ); > use Koha::Patron::Relationship; > > use t::lib::Mocks; >@@ -280,6 +281,36 @@ is( scalar(@$patstodel),2,'Borrowers without issues deleted by expiration_date a > $patstodel = GetBorrowersToExpunge( {not_borrowed_since => '2016-01-02', patron_list_id => $list1->patron_list_id() } ); > is( scalar(@$patstodel),2,'Borrowers without issues deleted by last issue date'); > >+# Test the "without_restriction_types" parameter of GetBorrowersToExpunge(). >+my $borrower3 = $builder->build( >+ { >+ source => 'Borrower', >+ value => { categorycode => 'CIVILIAN', flags => undef } >+ } >+); >+my $list2 = AddPatronList( { name => 'Test List 2', owner => $owner } ); >+AddPatronsToList( { list => $list2, borrowernumbers => [ $borrower3->{borrowernumber} ] } ); >+$patstodel = GetBorrowersToExpunge( >+ { >+ without_restriction_types => 'MANUAL', >+ patron_list_id => $list2->patron_list_id() >+ } >+); >+is( scalar(@$patstodel), 1, 'Borrower without restriction deleted' ); >+Koha::Patron::Debarments::AddDebarment( >+ { >+ borrowernumber => $borrower3->{borrowernumber}, >+ type => 'MANUAL' >+ } >+); >+$patstodel = GetBorrowersToExpunge( >+ { >+ without_restriction_types => 'MANUAL', >+ patron_list_id => $list2->patron_list_id() >+ } >+); >+is( scalar(@$patstodel), 0, 'Borrower with restriction not deleted' ); >+ > # Test GetBorrowersToExpunge and TrackLastPatronActivityTriggers > my $new_category = $builder->build_object( > { >-- >2.39.5
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 37418
:
169688
|
169879
| 176777