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