Line 0
Link Here
|
0 |
- |
1 |
use Modern::Perl; |
|
|
2 |
use Test::More tests => 1; |
3 |
|
4 |
use t::lib::TestBuilder; |
5 |
|
6 |
use Koha::Biblios; |
7 |
use Koha::Items; |
8 |
|
9 |
my $builder = t::lib::TestBuilder->new; |
10 |
|
11 |
subtest 'item->biblioitem' => sub { |
12 |
plan tests => 1; |
13 |
|
14 |
# NOTE This is a trick, if we want to populate the biblioitems table, we should not create a Biblio but a Biblioitem |
15 |
my $biblio = $builder->build( { source => 'Biblioitem', } )->{_fk}{biblionumber}; |
16 |
my $item1 = $builder->build( |
17 |
{ source => 'Item', |
18 |
value => { biblionumber => $biblio->{biblionumber}, biblioitemnumber => $biblio->{biblionumber} }, |
19 |
} |
20 |
); |
21 |
my $item2 = $builder->build( |
22 |
{ source => 'Item', |
23 |
value => { biblionumber => $biblio->{biblionumber}, biblioitemnumber => $biblio->{biblionumber} }, |
24 |
} |
25 |
); |
26 |
|
27 |
my $biblio_object = Koha::Biblios->find( $biblio->{biblionumber} ); |
28 |
my $item_object = Koha::Items->find( $item1->{itemnumber} ); |
29 |
|
30 |
is( $item_object->biblioitem->biblio->biblionumber, $biblio->{biblionumber} ); |
31 |
}; |