|
Lines 17-23
Link Here
|
| 17 |
|
17 |
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
|
19 |
|
| 20 |
use Test::More tests => 26; |
20 |
use Test::More tests => 27; |
| 21 |
use Test::NoWarnings; |
21 |
use Test::NoWarnings; |
| 22 |
use Test::MockModule; |
22 |
use Test::MockModule; |
| 23 |
use Test::Warn; |
23 |
use Test::Warn; |
|
Lines 1376-1381
subtest 'AddBiblio/ModBiblio calling ModBiblioMarc for field 005' => sub {
Link Here
|
| 1376 |
ok( $field && $field->data, 'Record contains field 005 after ModBiblio' ); |
1376 |
ok( $field && $field->data, 'Record contains field 005 after ModBiblio' ); |
| 1377 |
}; |
1377 |
}; |
| 1378 |
|
1378 |
|
|
|
1379 |
subtest 'PrepHostMarcField' => sub { |
| 1380 |
plan tests => 3; |
| 1381 |
|
| 1382 |
my $marcflavour = 'MARC21'; |
| 1383 |
t::lib::Mocks::mock_preference( 'marcflavour', $marcflavour ); |
| 1384 |
t::lib::Mocks::mock_preference( 'EasyAnalyticalRecords ', '1' ); |
| 1385 |
my $barcode = 123456; |
| 1386 |
my $marc_host = MARC::Record->new; |
| 1387 |
$marc_host->insert_fields_ordered( MARC::Field->new( '245', '0', '4', a => 'The Art of MARC Cataloguing' ) ); |
| 1388 |
my ( $biblionumber_host, $biblioitemnumber_host ) = C4::Biblio::AddBiblio( $marc_host, '' ); |
| 1389 |
my $item = |
| 1390 |
$schema->resultset('Item') |
| 1391 |
->create( |
| 1392 |
{ biblionumber => $biblionumber_host, biblioitemnumber => $biblioitemnumber_host, barcode => $barcode } ); |
| 1393 |
my $itemnumber = $item->itemnumber; |
| 1394 |
|
| 1395 |
my $field_773; |
| 1396 |
warning_is { $field_773 = C4::Biblio::PrepHostMarcField( $biblionumber_host, $itemnumber, $marcflavour ) } undef, |
| 1397 |
'No warnings in PrepHostMarcField'; |
| 1398 |
my $marc_anal = MARC::Record->new; |
| 1399 |
warning_is { $marc_anal->insert_fields_ordered($field_773) } undef, |
| 1400 |
'No warnings in insert_fields_ordered'; |
| 1401 |
my @subfields = $field_773->subfields; |
| 1402 |
my @empty_subfields = (); |
| 1403 |
|
| 1404 |
for my $s (@subfields) { |
| 1405 |
my $code = $s->[0]; |
| 1406 |
my $val = $s->[1]; |
| 1407 |
push @empty_subfields, $code unless $val ne ''; |
| 1408 |
} |
| 1409 |
is( scalar(@empty_subfields), 0, "No empty subfields" ); |
| 1410 |
}; |
| 1411 |
|
| 1379 |
# Cleanup |
1412 |
# Cleanup |
| 1380 |
Koha::Caches->get_instance->clear_from_cache("MarcSubfieldStructure-"); |
1413 |
Koha::Caches->get_instance->clear_from_cache("MarcSubfieldStructure-"); |
| 1381 |
$schema->storage->txn_rollback; |
1414 |
$schema->storage->txn_rollback; |
| 1382 |
- |
|
|