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.
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit b696642df7)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
parent
7f05cfc408
commit
0af79e24cc
|
|
@ -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' } );
|
||||
|
|
|
|||
Loading…
Reference in New Issue