Bug 27857: Fix Pseudonymization.t

t/db_dependent/Koha/Pseudonymization.t .. 2/3
    #   Failed test 'Attribute 1 should be retrieved correctly'
    #   at t/db_dependent/Koha/Pseudonymization.t line 198.
    #     Structures begin differing at:
    #          $got->{borrowernumber} = Does not exist
    #     $expected->{borrowernumber} = '58'

    #   Failed test 'Attribute 2 should be retrieved correctly'
    #   at t/db_dependent/Koha/Pseudonymization.t line 204.
    #     Structures begin differing at:
    #          $got->{borrowernumber} = Does not exist
    #     $expected->{borrowernumber} = '58'
    # Looks like you failed 2 tests of 3.
t/db_dependent/Koha/Pseudonymization.t .. 3/3

Highlighted by
  commit 7b40ee2203
  Bug 27857: Make Koha::Patron->extended_attributes validate data

Koha::Patron->add_extended_attributes should not modify the $attribute
hashref parameter we passed.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2021-04-12 11:08:01 +02:00
parent 5f25235b9e
commit 031dd035ab
1 changed files with 8 additions and 2 deletions

View File

@ -1539,8 +1539,14 @@ sub generate_userid {
sub add_extended_attribute {
my ($self, $attribute) = @_;
$attribute->{borrowernumber} = $self->borrowernumber;
return Koha::Patron::Attribute->new($attribute)->store;
return Koha::Patron::Attribute->new(
{
%$attribute,
( borrowernumber => $self->borrowernumber ),
}
)->store;
}
=head3 extended_attributes