Bugzilla – Attachment 184128 Details for
Bug 18772
t/ImportBatch.t generates warnings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18772: Remove warnings from t/ImportBatch.t
Bug-18772-Remove-warnings-from-tImportBatcht.patch (text/plain), 2.33 KB, created by
Jonathan Druart
on 2025-07-16 09:25:36 UTC
(
hide
)
Description:
Bug 18772: Remove warnings from t/ImportBatch.t
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-07-16 09:25:36 UTC
Size:
2.33 KB
patch
obsolete
>From 5d0a044cb6ada446dbe5ff5ef9c55a6f993ce938 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 16 Jul 2025 11:24:17 +0200 >Subject: [PATCH] Bug 18772: Remove warnings from t/ImportBatch.t > >Use of uninitialized value in concatenation (.) or string at /usr/local/share/perl/5.20.2/MARC/File/XML.pm line 399, <__ANONIO__> chunk 1. > >Those are 2 warnings coming from MARC::File::XML when called with >invalid XML. >We should not use Test::Warn as they are not expected and that may be >fixed upstream. >--- > t/ImportBatch.t | 24 +++++++++++++++++++++--- > 1 file changed, 21 insertions(+), 3 deletions(-) > >diff --git a/t/ImportBatch.t b/t/ImportBatch.t >index 749f9b06408..0258e4e5c3b 100755 >--- a/t/ImportBatch.t >+++ b/t/ImportBatch.t >@@ -17,11 +17,12 @@ > > use Modern::Perl; > >+use Test::More tests => 4; >+use Test::NoWarnings; > use File::Temp qw|tempfile|; > use MARC::Field; > use MARC::File::XML; > use MARC::Record; >-use Test::More tests => 3; > use t::lib::Mocks; > > BEGIN { >@@ -55,11 +56,28 @@ subtest 'RecordsFromMARCXMLFile' => sub { > > my ( $errors, $recs ); > my $file = create_file( { whitespace => 1, format => 'marcxml' } ); >- ( $errors, $recs ) = C4::ImportBatch::RecordsFromMARCXMLFile( $file, 'UTF-8' ); >+ { >+ # Ignore the following warning >+ # Use of uninitialized value in concatenation (.) or string at /usr/share/perl5/MARC/File/XML.pm line 399, <__ANONIO__> chunk 1. >+ # We do not want to expect it (using Test::Warn): it is a bug from MARC::File::XML >+ local $SIG{__WARN__} = sub { }; >+ my $dup_err; >+ local *STDERR; >+ open STDERR, ">>", \$dup_err; >+ ( $errors, $recs ) = C4::ImportBatch::RecordsFromMARCXMLFile( $file, 'UTF-8' ); >+ close STDERR; >+ } > is( @$recs, 0, 'No records from empty marcxml file' ); > > $file = create_file( { garbage => 1, format => 'marcxml' } ); >- ( $errors, $recs ) = C4::ImportBatch::RecordsFromMARCXMLFile( $file, 'UTF-8' ); >+ { >+ local $SIG{__WARN__} = sub { }; >+ my $dup_err; >+ local *STDERR; >+ open STDERR, ">>", \$dup_err; >+ ( $errors, $recs ) = C4::ImportBatch::RecordsFromMARCXMLFile( $file, 'UTF-8' ); >+ close STDERR; >+ } > is( @$recs, 0, 'Garbage returns no records' ); > > $file = create_file( { two => 1, format => 'marcxml' } ); >-- >2.34.1
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 18772
: 184128