Bugzilla – Attachment 190151 Details for
Bug 41145
Logging patron attributes logs even if there's no changes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41145: Add unit test coverage for stopping duplicated borrowerslog logging due to extended patron attributes being deleted on import
bf8f7bb.patch (text/plain), 3.51 KB, created by
Martin Renvoize (ashimema)
on 2025-12-04 12:51:23 UTC
(
hide
)
Description:
Bug 41145: Add unit test coverage for stopping duplicated borrowerslog logging due to extended patron attributes being deleted on import
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-12-04 12:51:23 UTC
Size:
3.51 KB
patch
obsolete
>From bf8f7bb58898c0d343eba62ffebdc808a3f177da Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Wed, 12 Nov 2025 00:01:03 +0000 >Subject: [PATCH] Bug 41145: Add unit test coverage for stopping duplicated > borrowerslog logging due to extended patron attributes being deleted on > import > >This adds to the unit tests in t/db_dependent/Koha/Patrons/Import.t. It confirms that repeating the same patron import (with extended patron attributes) will not generate duplicated borrowersLog entries. > >Test plan: >1. prove t/db_dependent/Koha/Patrons/Import.t > >Sponsored-by: Auckland University of Technology >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> >--- > t/db_dependent/Koha/Patrons/Import.t | 45 +++++++++++++++++++++++++++- > 1 file changed, 44 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Patrons/Import.t b/t/db_dependent/Koha/Patrons/Import.t >index c552fe019ca..60c5ec6e04e 100755 >--- a/t/db_dependent/Koha/Patrons/Import.t >+++ b/t/db_dependent/Koha/Patrons/Import.t >@@ -30,6 +30,7 @@ use Test::MockModule; > use Koha::Database; > use Koha::Patron::Relationships; > use Koha::DateUtils qw(dt_from_string); >+use Koha::ActionLogs; > > use File::Temp qw(tempfile tempdir); > my $temp_dir = tempdir( 'Koha_patrons_import_test_XXXX', CLEANUP => 1, TMPDIR => 1 ); >@@ -1497,7 +1498,9 @@ subtest 'patron_attributes' => sub { > } > > subtest 'update existing patron' => sub { >- plan tests => 19; >+ plan tests => 22; >+ >+ t::lib::Mocks::mock_preference( 'BorrowersLog', 0 ); > > my $patron = $builder->build_object( > { >@@ -1523,8 +1526,19 @@ subtest 'patron_attributes' => sub { > > is( $result->{overwritten}, 1 ); > >+ my $action_logs = Koha::ActionLogs->search( >+ { >+ module => "MEMBERS", >+ action => "MODIFY", >+ object => $patron->borrowernumber, >+ } >+ ); >+ is( $action_logs->count, 0, ' ' ); >+ > compare_patron_attributes( $patron->extended_attributes->unblessed, {%$attributes} ); > >+ t::lib::Mocks::mock_preference( 'BorrowersLog', 1 ); >+ > # Adding a new non-repeatable attribute > my $new_attributes = { > $normal_attribute_type->code => ['my normal attribute 2'], >@@ -1544,6 +1558,35 @@ subtest 'patron_attributes' => sub { > # The normal_attribute_type has been replaced with 'my normal attribute 2' > compare_patron_attributes( $patron->extended_attributes->unblessed, { %$attributes, %$new_attributes } ); > >+ $action_logs = Koha::ActionLogs->search( >+ { >+ module => "MEMBERS", >+ action => "MODIFY", >+ object => $patron->borrowernumber, >+ } >+ ); >+ >+ is( $action_logs->count, 1, ' ' ); >+ >+ $result = $patrons_import->import_patrons( >+ { >+ file => $fh, >+ matchpoint => 'cardnumber', >+ overwrite_cardnumber => 1, >+ preserve_extended_attributes => 1 >+ } >+ ); >+ >+ $action_logs = Koha::ActionLogs->search( >+ { >+ module => "MEMBERS", >+ action => "MODIFY", >+ object => $patron->borrowernumber, >+ } >+ ); >+ >+ is( $action_logs->count, 1, ' ' ); >+ > # UniqueIDConstraint > $patron->extended_attributes->delete; # reset > $builder->build_object( >-- >2.52.0 >
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 41145
:
189503
|
189504
|
190139
|
190140
|
190150
| 190151