|
Lines 645-651
subtest 'ModBiblio called from linker test' => sub {
Link Here
|
| 645 |
}; |
645 |
}; |
| 646 |
|
646 |
|
| 647 |
subtest "LinkBibHeadingsToAuthorities record generation tests" => sub { |
647 |
subtest "LinkBibHeadingsToAuthorities record generation tests" => sub { |
| 648 |
plan tests => 3; |
648 |
plan tests => 6; |
| 649 |
|
649 |
|
| 650 |
# Set up mocks to ensure authorities are generated |
650 |
# Set up mocks to ensure authorities are generated |
| 651 |
my $biblio_mod = Test::MockModule->new( 'C4::Linker::Default' ); |
651 |
my $biblio_mod = Test::MockModule->new( 'C4::Linker::Default' ); |
|
Lines 679-684
subtest "LinkBibHeadingsToAuthorities record generation tests" => sub {
Link Here
|
| 679 |
"The generated record contains the correct subfields" |
679 |
"The generated record contains the correct subfields" |
| 680 |
); |
680 |
); |
| 681 |
|
681 |
|
|
|
682 |
# Example series link with volume and punctuation |
| 683 |
$record = MARC::Record->new(); |
| 684 |
$field = MARC::Field->new('800','','','a' => 'Tolkien, J. R. R.', 'q' => '(John Ronald Reuel),', 'd' => '1892-1973.', 't' => 'Lord of the rings ;', 'v' => '1'); |
| 685 |
$record->append_fields($field); |
| 686 |
|
| 687 |
( $num_headings_changed, $results ) = LinkBibHeadingsToAuthorities($linker, $record, "",undef); |
| 688 |
|
| 689 |
is( $num_headings_changed, 1, 'We changed the one we passed' ); |
| 690 |
is_deeply( $results->{added}, |
| 691 |
{"Tolkien, J. R. R. (John Ronald Reuel), 1892-1973. Lord of the rings ;" => 1 }, |
| 692 |
"We added an authority record for the heading" |
| 693 |
); |
| 694 |
|
| 695 |
# Now we check the authority record itself |
| 696 |
$authority = GetAuthority( $record->subfield('800','9') ); |
| 697 |
is( $authority->field('100')->as_string(), |
| 698 |
"Tolkien, J. R. R. (John Ronald Reuel), 1892-1973. Lord of the rings", |
| 699 |
"The generated record contains the correct subfields" |
| 700 |
); |
| 701 |
|
| 702 |
|
| 703 |
|
| 682 |
}; |
704 |
}; |
| 683 |
|
705 |
|
| 684 |
# Cleanup |
706 |
# Cleanup |