Bug 22001: Fix Koha/Patrons.t

The message is only printed once

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2020-03-31 17:54:36 +02:00 committed by Martin Renvoize
parent 41905c7eaa
commit c89e0a18d6
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
1 changed files with 1 additions and 4 deletions

View File

@ -2095,12 +2095,9 @@ subtest 'extended_attributes' => sub {
$patron_2->extended_attributes->filter_by_branch_limitations->delete;
$patron_1->extended_attributes($attributes_for_1);
my $print_error = $schema->storage->dbh->{PrintError};
$schema->storage->dbh->{PrintError} = 0;
warning_like {
$patron_2->extended_attributes($attributes_for_2);
} [ qr/a foreign key constraint fails/, qr/a foreign key constraint fails/ ], 'nonexistent attribute should have not exploded but print a warning';
$schema->storage->dbh->{PrintError} = $print_error;
} [ qr/a foreign key constraint fails/ ], 'nonexistent attribute should have not exploded but print a warning';
my $extended_attributes_for_1 = $patron_1->extended_attributes;
is( $extended_attributes_for_1->count, 3, 'There should be 3 attributes now for patron 1');