Line 0
Link Here
|
0 |
- |
1 |
#!/usr/bin/perl |
|
|
2 |
|
3 |
# Copyright 2020 BULAC |
4 |
# |
5 |
# This file is part of Koha |
6 |
# |
7 |
# Koha is free software; you can redistribute it and/or modify it |
8 |
# under the terms of the GNU General Public License as published by |
9 |
# the Free Software Foundation; either version 3 of the License, or |
10 |
# (at your option) any later version. |
11 |
# |
12 |
# Koha is distributed in the hope that it will be useful, but |
13 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
# GNU General Public License for more details. |
16 |
# |
17 |
# You should have received a copy of the GNU General Public License |
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
19 |
|
20 |
use Modern::Perl; |
21 |
|
22 |
use Test::More tests => 2; |
23 |
|
24 |
use C4::Biblio; |
25 |
use C4::Circulation; |
26 |
|
27 |
use Koha::Items; |
28 |
use Koha::Database; |
29 |
use Koha::Old::Items; |
30 |
|
31 |
use List::MoreUtils qw(all); |
32 |
|
33 |
use t::lib::TestBuilder; |
34 |
use t::lib::Mocks; |
35 |
|
36 |
my $schema = Koha::Database->new->schema; |
37 |
my $builder = t::lib::TestBuilder->new; |
38 |
|
39 |
|
40 |
$schema->storage->txn_begin; |
41 |
my $library = $builder->build( { source => 'Branch' } ); |
42 |
my $nb_of_items = Koha::Items->search->count; |
43 |
my $biblio = $builder->build_sample_biblio(); |
44 |
my $new_item = $builder->build_sample_item({ |
45 |
biblionumber => $biblio->biblionumber, |
46 |
homebranch => $library->{branchcode}, |
47 |
holdingbranch => $library->{branchcode}, |
48 |
}); |
49 |
my $home_branch = $new_item->home_branch; |
50 |
is(ref($home_branch), 'Koha::Library', 'Returns a Koha::Library resultset' ); |
51 |
my $holding_branch = $new_item->holding_branch; |
52 |
is(ref($holding_branch), 'Koha::Library', 'Returns a Koha::Library resultset' ); |
53 |
$schema->storage->txn_rollback; |
54 |
|
55 |
|