Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 14; |
20 |
use Test::More tests => 15; |
21 |
|
21 |
|
22 |
use C4::Biblio; |
22 |
use C4::Biblio; |
23 |
use Koha::Database; |
23 |
use Koha::Database; |
Lines 614-619
subtest 'get_marc_notes() UNIMARC tests' => sub {
Link Here
|
614 |
is( $notes->[0]->{marcnote}, 'Note1', 'First note' ); |
614 |
is( $notes->[0]->{marcnote}, 'Note1', 'First note' ); |
615 |
is( $notes->[1]->{marcnote}, 'Note2', 'Second note' ); |
615 |
is( $notes->[1]->{marcnote}, 'Note2', 'Second note' ); |
616 |
is( @$notes, 2, 'No more notes' ); |
616 |
is( @$notes, 2, 'No more notes' ); |
|
|
617 |
}; |
618 |
|
619 |
subtest 'get_host_item_entries() tests' => sub { |
620 |
|
621 |
plan tests => 2; |
622 |
|
623 |
$schema->storage->txn_begin; |
624 |
|
625 |
# Set up the host record and an item |
626 |
my $host_biblio = $builder->build_sample_biblio; |
627 |
my $host_item = $builder->build_sample_item({ biblionumber => $host_biblio->biblionumber }); |
628 |
|
629 |
# Set up the test record |
630 |
my $test_biblio = $builder->build_sample_biblio; |
631 |
my $record = $test_biblio->metadata->record; |
632 |
|
633 |
# Link the host item to the test record |
634 |
my $field = MARC::Field->new('245','','','a' => "Test title"); |
635 |
$record->append_fields( $field ); |
636 |
$field = MARC::Field->new('773','0','','0' => $host_biblio->biblionumber); |
637 |
$record->append_fields( $field ); |
638 |
$field = MARC::Field->new('773','0','','9' => $host_item->itemnumber); |
639 |
$record->append_fields( $field ); |
640 |
|
641 |
# Re-retrieve the record |
642 |
C4::Biblio::ModBiblio( $record, $test_biblio->biblionumber ); |
643 |
$test_biblio = Koha::Biblios->find( $test_biblio->biblionumber ); |
644 |
|
645 |
my $host_items = $test_biblio->get_host_item_entries; |
646 |
is( @{$host_items}, 1, "Correctly retrieved number of attached host item entries" ); |
647 |
my $test_host_biblionumber = @{$host_items}[0]->subfield('0'); |
648 |
is( $test_host_biblionumber, $host_biblio->biblionumber, "Correctly retrieved data about host item entry"); |
617 |
|
649 |
|
618 |
$schema->storage->txn_rollback; |
650 |
$schema->storage->txn_rollback; |
619 |
}; |
651 |
}; |