Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 25; |
20 |
use Test::More tests => 26; |
21 |
use Test::MockModule; |
21 |
use Test::MockModule; |
22 |
use Test::Warn; |
22 |
use Test::Warn; |
23 |
use List::MoreUtils qw( uniq ); |
23 |
use List::MoreUtils qw( uniq ); |
Lines 37-43
use C4::Linker::Default qw( get_link );
Link Here
|
37 |
BEGIN { |
37 |
BEGIN { |
38 |
use_ok( |
38 |
use_ok( |
39 |
'C4::Biblio', |
39 |
'C4::Biblio', |
40 |
qw( AddBiblio GetMarcFromKohaField BiblioAutoLink GetMarcSubfieldStructure GetMarcSubfieldStructureFromKohaField LinkBibHeadingsToAuthorities GetBiblioData ModBiblio GetMarcISSN GetMarcISBN GetMarcPrice GetFrameworkCode GetMarcUrls IsMarcStructureInternal GetMarcStructure GetXmlBiblio DelBiblio ) |
40 |
qw( AddBiblio GetMarcFromKohaField BiblioAutoLink GetMarcSubfieldStructure GetMarcSubfieldStructureFromKohaField LinkBibHeadingsToAuthorities GetBiblioData ModBiblio GetMarcISSN GetMarcISBN GetMarcPrice GetFrameworkCode GetMarcUrls IsMarcStructureInternal GetMarcStructure GetXmlBiblio DelBiblio prepare_host_field ) |
41 |
); |
41 |
); |
42 |
} |
42 |
} |
43 |
|
43 |
|
Lines 1378-1383
subtest 'AddBiblio/ModBiblio calling ModBiblioMarc for field 005' => sub {
Link Here
|
1378 |
ok( $field && $field->data, 'Record contains field 005 after ModBiblio' ); |
1378 |
ok( $field && $field->data, 'Record contains field 005 after ModBiblio' ); |
1379 |
}; |
1379 |
}; |
1380 |
|
1380 |
|
|
|
1381 |
subtest 'Construction of field 773' => sub { |
1382 |
plan tests => 1; |
1383 |
|
1384 |
my $marc_record = MARC::Record->new; |
1385 |
$marc_record->leader(' cam a22 i 4500'); |
1386 |
$marc_record->insert_fields_ordered( MARC::Field->new( '001', 'e50010474705' ) ); |
1387 |
$marc_record->insert_fields_ordered( MARC::Field->new( '003', 'UkLCURL' ) ); |
1388 |
$marc_record->insert_fields_ordered( MARC::Field->new( '020', ' ', ' ', a => '0130810819' ) ); |
1389 |
$marc_record->insert_fields_ordered( MARC::Field->new( '020', ' ', ' ', a => '020163354x' ) ); |
1390 |
$marc_record->insert_fields_ordered( MARC::Field->new( '100', '1', ' ', a => 'Stevens, W. Richard' ) ); |
1391 |
$marc_record->insert_fields_ordered( |
1392 |
MARC::Field->new( |
1393 |
'245', '1', '0', |
1394 |
a => 'UNIX network programming.', |
1395 |
n => 'Vol. 2,', |
1396 |
p => 'Interprocess communications /', |
1397 |
c => 'by W. Richard Stevens.' |
1398 |
) |
1399 |
); |
1400 |
$marc_record->insert_fields_ordered( MARC::Field->new( '250', ' ', ' ', a => '2nd edition' ) ); |
1401 |
$marc_record->insert_fields_ordered( |
1402 |
MARC::Field->new( |
1403 |
'260', ' ', ' ', |
1404 |
a => 'Upper Saddle River, N.J. :', |
1405 |
b => 'Prentice Hall PTR,', |
1406 |
c => 'c1999.' |
1407 |
) |
1408 |
); |
1409 |
$marc_record->insert_fields_ordered( |
1410 |
MARC::Field->new( |
1411 |
'490', '1', ' ', |
1412 |
a => 'Addison-Wesley professional computing series' |
1413 |
) |
1414 |
); |
1415 |
$marc_record->insert_fields_ordered( |
1416 |
MARC::Field->new( |
1417 |
'830', ' ', '0', |
1418 |
a => 'Addison-Wesley professional computing series', |
1419 |
x => '1234-5678' |
1420 |
) |
1421 |
); |
1422 |
$marc_record->insert_fields_ordered( MARC::Field->new( '942', '0', ' ', c => 'BK' ) ); |
1423 |
|
1424 |
my $expected_field_773 = MARC::Field->new( |
1425 |
'773', '0', ' ', |
1426 |
7 => 'p1am', |
1427 |
a => 'Stevens, W. Richard', |
1428 |
t => 'UNIX network programming. Vol. 2, Interprocess communications', |
1429 |
b => '2nd edition', |
1430 |
d => 'Upper Saddle River, N.J. : Prentice Hall PTR, c1999', |
1431 |
k => 'Addison-Wesley professional computing series, ISSN 1234-5678', |
1432 |
z => '020163354x', |
1433 |
z => '0130810819', |
1434 |
w => '(UkLCURL)e50010474705' |
1435 |
); |
1436 |
my ( $biblionumber, undef ) = |
1437 |
AddBiblio( $marc_record, '', { skip_record_index => 1 } ); |
1438 |
my $host_field = prepare_host_field( $biblionumber, 'MARC21' ); |
1439 |
is( |
1440 |
$host_field->as_formatted, |
1441 |
$expected_field_773->as_formatted, |
1442 |
'Host field 773 formed corrrectly' |
1443 |
); |
1444 |
}; |
1445 |
|
1381 |
# Cleanup |
1446 |
# Cleanup |
1382 |
Koha::Caches->get_instance->clear_from_cache("MarcSubfieldStructure-"); |
1447 |
Koha::Caches->get_instance->clear_from_cache("MarcSubfieldStructure-"); |
1383 |
$schema->storage->txn_rollback; |
1448 |
$schema->storage->txn_rollback; |
1384 |
- |
|
|