Lines 17-27
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
|
|
20 |
use Test::More tests => 4; |
21 |
use Test::NoWarnings; |
20 |
use File::Temp qw|tempfile|; |
22 |
use File::Temp qw|tempfile|; |
21 |
use MARC::Field; |
23 |
use MARC::Field; |
22 |
use MARC::File::XML; |
24 |
use MARC::File::XML; |
23 |
use MARC::Record; |
25 |
use MARC::Record; |
24 |
use Test::More tests => 3; |
|
|
25 |
use t::lib::Mocks; |
26 |
use t::lib::Mocks; |
26 |
|
27 |
|
27 |
BEGIN { |
28 |
BEGIN { |
Lines 55-65
subtest 'RecordsFromMARCXMLFile' => sub {
Link Here
|
55 |
|
56 |
|
56 |
my ( $errors, $recs ); |
57 |
my ( $errors, $recs ); |
57 |
my $file = create_file( { whitespace => 1, format => 'marcxml' } ); |
58 |
my $file = create_file( { whitespace => 1, format => 'marcxml' } ); |
58 |
( $errors, $recs ) = C4::ImportBatch::RecordsFromMARCXMLFile( $file, 'UTF-8' ); |
59 |
{ |
|
|
60 |
# Ignore the following warning |
61 |
# Use of uninitialized value in concatenation (.) or string at /usr/share/perl5/MARC/File/XML.pm line 399, <__ANONIO__> chunk 1. |
62 |
# We do not want to expect it (using Test::Warn): it is a bug from MARC::File::XML |
63 |
local $SIG{__WARN__} = sub { }; |
64 |
my $dup_err; |
65 |
local *STDERR; |
66 |
open STDERR, ">>", \$dup_err; |
67 |
( $errors, $recs ) = C4::ImportBatch::RecordsFromMARCXMLFile( $file, 'UTF-8' ); |
68 |
close STDERR; |
69 |
} |
59 |
is( @$recs, 0, 'No records from empty marcxml file' ); |
70 |
is( @$recs, 0, 'No records from empty marcxml file' ); |
60 |
|
71 |
|
61 |
$file = create_file( { garbage => 1, format => 'marcxml' } ); |
72 |
$file = create_file( { garbage => 1, format => 'marcxml' } ); |
62 |
( $errors, $recs ) = C4::ImportBatch::RecordsFromMARCXMLFile( $file, 'UTF-8' ); |
73 |
{ |
|
|
74 |
local $SIG{__WARN__} = sub { }; |
75 |
my $dup_err; |
76 |
local *STDERR; |
77 |
open STDERR, ">>", \$dup_err; |
78 |
( $errors, $recs ) = C4::ImportBatch::RecordsFromMARCXMLFile( $file, 'UTF-8' ); |
79 |
close STDERR; |
80 |
} |
63 |
is( @$recs, 0, 'Garbage returns no records' ); |
81 |
is( @$recs, 0, 'Garbage returns no records' ); |
64 |
|
82 |
|
65 |
$file = create_file( { two => 1, format => 'marcxml' } ); |
83 |
$file = create_file( { two => 1, format => 'marcxml' } ); |
66 |
- |
|
|