Lines 19-24
use Modern::Perl;
Link Here
|
19 |
|
19 |
|
20 |
use Test::More tests => 15; |
20 |
use Test::More tests => 15; |
21 |
use Test::MockModule; |
21 |
use Test::MockModule; |
|
|
22 |
use Test::Warn; |
22 |
use List::MoreUtils qw( uniq ); |
23 |
use List::MoreUtils qw( uniq ); |
23 |
use MARC::Record; |
24 |
use MARC::Record; |
24 |
|
25 |
|
Lines 43-49
Koha::Caches->get_instance->clear_from_cache( "MarcSubfieldStructure-" );
Link Here
|
43 |
my $builder = t::lib::TestBuilder->new; |
44 |
my $builder = t::lib::TestBuilder->new; |
44 |
|
45 |
|
45 |
subtest 'AddBiblio' => sub { |
46 |
subtest 'AddBiblio' => sub { |
46 |
plan tests => 3; |
47 |
plan tests => 4; |
47 |
|
48 |
|
48 |
my $marcflavour = 'MARC21'; |
49 |
my $marcflavour = 'MARC21'; |
49 |
t::lib::Mocks::mock_preference( 'marcflavour', $marcflavour ); |
50 |
t::lib::Mocks::mock_preference( 'marcflavour', $marcflavour ); |
Lines 56-67
subtest 'AddBiblio' => sub {
Link Here
|
56 |
|
57 |
|
57 |
my $nb_biblios = Koha::Biblios->count; |
58 |
my $nb_biblios = Koha::Biblios->count; |
58 |
my ( $biblionumber, $biblioitemnumber ); |
59 |
my ( $biblionumber, $biblioitemnumber ); |
59 |
{ |
60 |
warnings_like { ( $biblionumber, $biblioitemnumber ) = C4::Biblio::AddBiblio( $record, '' ) } |
60 |
local *STDERR; |
61 |
[ qr/Data too long for column 'lccn'/, qr/Data too long for column 'lccn'/ ], |
61 |
open STDERR, '>', '/dev/null'; |
62 |
"expected warnings when adding too long LCCN"; |
62 |
( $biblionumber, $biblioitemnumber ) = C4::Biblio::AddBiblio( $record, '' ); |
|
|
63 |
close STDERR; |
64 |
} |
65 |
is( $biblionumber, undef, |
63 |
is( $biblionumber, undef, |
66 |
'AddBiblio returns undef for biblionumber if something went wrong' ); |
64 |
'AddBiblio returns undef for biblionumber if something went wrong' ); |
67 |
is( $biblioitemnumber, undef, |
65 |
is( $biblioitemnumber, undef, |
68 |
- |
|
|