Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 11; |
22 |
use Test::More tests => 12; |
23 |
use Test::Exception; |
23 |
use Test::Exception; |
24 |
|
24 |
|
25 |
use C4::Biblio qw( GetMarcSubfieldStructure ); |
25 |
use C4::Biblio qw( GetMarcSubfieldStructure ); |
Lines 38-43
use t::lib::Mocks;
Link Here
|
38 |
my $schema = Koha::Database->new->schema; |
38 |
my $schema = Koha::Database->new->schema; |
39 |
my $builder = t::lib::TestBuilder->new; |
39 |
my $builder = t::lib::TestBuilder->new; |
40 |
|
40 |
|
|
|
41 |
subtest 'tracked_links relationship' => sub { |
42 |
plan tests => 3; |
43 |
|
44 |
my $biblio = $builder->build_sample_biblio(); |
45 |
my $item = $builder->build_sample_item({ |
46 |
biblionumber => $biblio->biblionumber, |
47 |
}); |
48 |
my $tracked_links = $item->tracked_links; |
49 |
is( ref($tracked_links), 'Koha::TrackedLinks', 'tracked_links returns a Koha::TrackedLinks object set' ); |
50 |
is($item->tracked_links->count, 0, "Empty Koha::TrackedLinks set returned if no tracked_links"); |
51 |
my $link1 = $builder->build({ source => 'LinkTracker', value => { itemnumber => $item->itemnumber }}); |
52 |
my $link2 = $builder->build({ source => 'LinkTracker', value => { itemnumber => $item->itemnumber }}); |
53 |
|
54 |
is($item->tracked_links()->count,2,"Two tracked links found"); |
55 |
}; |
56 |
|
41 |
subtest 'hidden_in_opac() tests' => sub { |
57 |
subtest 'hidden_in_opac() tests' => sub { |
42 |
|
58 |
|
43 |
plan tests => 4; |
59 |
plan tests => 4; |
44 |
- |
|
|