Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 21; # +1 |
20 |
use Test::More tests => 22; # +1 |
21 |
use Test::Warn; |
21 |
use Test::Warn; |
22 |
|
22 |
|
23 |
use C4::Biblio qw( AddBiblio ModBiblio ModBiblioMarc ); |
23 |
use C4::Biblio qw( AddBiblio ModBiblio ModBiblioMarc ); |
Lines 743-748
subtest 'get_marc_notes() UNIMARC tests' => sub {
Link Here
|
743 |
is( $notes->[0]->{marcnote}, 'Note1', 'First note' ); |
743 |
is( $notes->[0]->{marcnote}, 'Note1', 'First note' ); |
744 |
is( $notes->[1]->{marcnote}, 'Note2', 'Second note' ); |
744 |
is( $notes->[1]->{marcnote}, 'Note2', 'Second note' ); |
745 |
is( @$notes, 2, 'No more notes' ); |
745 |
is( @$notes, 2, 'No more notes' ); |
|
|
746 |
}; |
747 |
|
748 |
subtest 'get_host_item_entries() tests' => sub { |
749 |
|
750 |
plan tests => 2; |
751 |
|
752 |
$schema->storage->txn_begin; |
753 |
|
754 |
# Set up the host record and an item |
755 |
my $host_biblio = $builder->build_sample_biblio; |
756 |
my $host_item = $builder->build_sample_item({ biblionumber => $host_biblio->biblionumber }); |
757 |
|
758 |
# Set up the test record |
759 |
my $test_biblio = $builder->build_sample_biblio; |
760 |
my $record = $test_biblio->metadata->record; |
761 |
|
762 |
# Link the host item to the test record |
763 |
my $field = MARC::Field->new('245','','','a' => "Test title"); |
764 |
$record->append_fields( $field ); |
765 |
$field = MARC::Field->new('773','0','','0' => $host_biblio->biblionumber); |
766 |
$record->append_fields( $field ); |
767 |
$field = MARC::Field->new('773','0','','9' => $host_item->itemnumber); |
768 |
$record->append_fields( $field ); |
769 |
|
770 |
# Re-retrieve the record |
771 |
C4::Biblio::ModBiblio( $record, $test_biblio->biblionumber ); |
772 |
$test_biblio = Koha::Biblios->find( $test_biblio->biblionumber ); |
773 |
|
774 |
my $host_items = $test_biblio->get_host_item_entries; |
775 |
is( @{$host_items}, 1, "Correctly retrieved number of attached host item entries" ); |
776 |
my $test_host_biblionumber = @{$host_items}[0]->subfield('0'); |
777 |
is( $test_host_biblionumber, $host_biblio->biblionumber, "Correctly retrieved data about host item entry"); |
746 |
|
778 |
|
747 |
$schema->storage->txn_rollback; |
779 |
$schema->storage->txn_rollback; |
748 |
}; |
780 |
}; |