Bug 24094: Unit tests
Signed-off-by: Myka Kennedy Stephens <mkstephens@lancasterseminary.edu> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
43dd880d4f
commit
f2cbcdbb99
|
|
@ -645,7 +645,7 @@ subtest 'ModBiblio called from linker test' => sub {
|
|||
};
|
||||
|
||||
subtest "LinkBibHeadingsToAuthorities record generation tests" => sub {
|
||||
plan tests => 3;
|
||||
plan tests => 6;
|
||||
|
||||
# Set up mocks to ensure authorities are generated
|
||||
my $biblio_mod = Test::MockModule->new( 'C4::Linker::Default' );
|
||||
|
|
@ -679,6 +679,28 @@ subtest "LinkBibHeadingsToAuthorities record generation tests" => sub {
|
|||
"The generated record contains the correct subfields"
|
||||
);
|
||||
|
||||
# Example series link with volume and punctuation
|
||||
$record = MARC::Record->new();
|
||||
$field = MARC::Field->new('800','','','a' => 'Tolkien, J. R. R.', 'q' => '(John Ronald Reuel),', 'd' => '1892-1973.', 't' => 'Lord of the rings ;', 'v' => '1');
|
||||
$record->append_fields($field);
|
||||
|
||||
( $num_headings_changed, $results ) = LinkBibHeadingsToAuthorities($linker, $record, "",undef);
|
||||
|
||||
is( $num_headings_changed, 1, 'We changed the one we passed' );
|
||||
is_deeply( $results->{added},
|
||||
{"Tolkien, J. R. R. (John Ronald Reuel), 1892-1973. Lord of the rings ;" => 1 },
|
||||
"We added an authority record for the heading"
|
||||
);
|
||||
|
||||
# Now we check the authority record itself
|
||||
$authority = GetAuthority( $record->subfield('800','9') );
|
||||
is( $authority->field('100')->as_string(),
|
||||
"Tolkien, J. R. R. (John Ronald Reuel), 1892-1973. Lord of the rings",
|
||||
"The generated record contains the correct subfields"
|
||||
);
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
# Cleanup
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Test::More tests => 3;
|
||||
use Test::More tests => 5;
|
||||
use C4::Context;
|
||||
|
||||
BEGIN {
|
||||
|
|
@ -19,4 +19,10 @@ SKIP: {
|
|||
my $heading = C4::Heading->new_from_bib_field($field);
|
||||
is($heading->display_form(), 'Uncles--Fiction', 'Display form generation');
|
||||
is($heading->search_form(), 'Uncles generalsubdiv Fiction', 'Search form generation');
|
||||
|
||||
$field = MARC::Field->new( '830', ' ', '4', a => 'The dark is rising ;', v => '3' );
|
||||
$heading = C4::Heading->new_from_bib_field($field);
|
||||
is($heading->display_form(), 'The dark is rising ;', 'Display form generation');
|
||||
is($heading->search_form(), 'The dark is rising', 'Search form generation');
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue