Bugzilla – Attachment 165213 Details for
Bug 26744
Log changes to extended patron attributes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26744: Add test for multiple values of repeatable fields
Bug-26744-Add-test-for-multiple-values-of-repeatab.patch (text/plain), 3.14 KB, created by
David Gustafsson
on 2024-04-19 15:14:50 UTC
(
hide
)
Description:
Bug 26744: Add test for multiple values of repeatable fields
Filename:
MIME Type:
Creator:
David Gustafsson
Created:
2024-04-19 15:14:50 UTC
Size:
3.14 KB
patch
obsolete
>From 38743eacc4970b30e56bbcff5331713a54e220a7 Mon Sep 17 00:00:00 2001 >From: David Gustafsson <david.gustafsson@ub.gu.se> >Date: Fri, 19 Apr 2024 17:13:36 +0200 >Subject: [PATCH] Bug 26744: Add test for multiple values of repeatable fields > >--- > t/db_dependent/Koha/Patron/Attribute.t | 74 +++++++++++++++++++++++++- > 1 file changed, 72 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Koha/Patron/Attribute.t b/t/db_dependent/Koha/Patron/Attribute.t >index 705acee8101..4d9b72a010f 100755 >--- a/t/db_dependent/Koha/Patron/Attribute.t >+++ b/t/db_dependent/Koha/Patron/Attribute.t >@@ -409,7 +409,7 @@ subtest 'merge_and_replace_with' => sub { > }; > > subtest 'action log tests' => sub { >- plan tests => 9; >+ plan tests => 11; > my $schema = Koha::Database->new->schema; > $schema->storage->txn_begin; > >@@ -421,7 +421,12 @@ subtest 'action log tests' => sub { > }; > if ($repeatable) { > while (my ($k, $v) = each %{$change}) { >- $change->{$k} = $v ? [$v] : []; >+ if (ref $v eq 'ARRAY') { >+ $change->{$k} = [sort @{$v}]; >+ } >+ else { >+ $change->{$k} = $v ? [$v] : []; >+ } > } > } > return "Patron attribute " . $code . ": " . to_json($change, { pretty => 1, canonical => 1 }); >@@ -557,6 +562,71 @@ subtest 'action log tests' => sub { > ); > } > >+ $attributes = [ >+ { >+ attribute => 'Foo', >+ code => $attribute_type->code, >+ }, >+ { >+ attribute => 'Bar', >+ code => $attribute_type->code, >+ } >+ ]; >+ $patron->extended_attributes($attributes); >+ >+ $info = $get_info->([], ['Foo', 'Bar'], $attribute_type->code, 1); >+ use Data::Dumper; >+ print Dumper($info); >+ $action_logs = Koha::ActionLogs->search( >+ { >+ module => "MEMBERS", >+ action => "MODIFY", >+ object => $patron->borrowernumber, >+ info => $info >+ } >+ ); >+ is( >+ $action_logs->count, >+ 1, >+ "New action log entry has been created when updating repeatable patron attribute with multiple values" >+ ); >+ >+ $attributes = [ >+ { >+ attribute => 'Foo', >+ code => $attribute_type->code, >+ }, >+ { >+ attribute => 'Bar', >+ code => $attribute_type->code, >+ }, >+ { >+ attribute => 'Baz', >+ code => $attribute_type->code, >+ } >+ ]; >+ $patron->extended_attributes($attributes); >+ >+ $info = $get_info->( >+ ['Foo', 'Bar'], >+ ['Foo', 'Bar', 'Baz'], >+ $attribute_type->code, >+ 1 >+ ); >+ $action_logs = Koha::ActionLogs->search( >+ { >+ module => "MEMBERS", >+ action => "MODIFY", >+ object => $patron->borrowernumber, >+ info => $info >+ } >+ ); >+ is( >+ $action_logs->count, >+ 1, >+ "New action log entry has been created when updating repeatable patron attribute with existing multiple values with multiple values" >+ ); >+ > $schema->storage->txn_rollback; > }; > >-- >2.43.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 26744
:
163957
|
163958
|
163959
|
164034
|
164035
|
164098
|
165212
|
165213
|
165301
|
165302
|
165303
|
165304
|
165305