Lines 20-28
use Modern::Perl;
Link Here
|
20 |
|
20 |
|
21 |
use MARC::Record; |
21 |
use MARC::Record; |
22 |
use C4::Biblio; |
22 |
use C4::Biblio; |
|
|
23 |
use C4::Branch; |
23 |
use Koha::Database; |
24 |
use Koha::Database; |
|
|
25 |
use Data::Printer; |
24 |
|
26 |
|
25 |
use Test::More tests => 4; |
27 |
use Test::More tests => 5; |
26 |
|
28 |
|
27 |
BEGIN { |
29 |
BEGIN { |
28 |
use_ok('C4::Items'); |
30 |
use_ok('C4::Items'); |
Lines 38-45
subtest 'General Add, Get and Del tests' => sub {
Link Here
|
38 |
$dbh->{AutoCommit} = 0; |
40 |
$dbh->{AutoCommit} = 0; |
39 |
$dbh->{RaiseError} = 1; |
41 |
$dbh->{RaiseError} = 1; |
40 |
|
42 |
|
41 |
# Helper biblio. |
43 |
# Create a biblio instance for testing |
42 |
diag("Creating biblio instance for testing."); |
|
|
43 |
my ($bibnum, $bibitemnum) = get_biblio(); |
44 |
my ($bibnum, $bibitemnum) = get_biblio(); |
44 |
|
45 |
|
45 |
# Add an item. |
46 |
# Add an item. |
Lines 143-148
subtest 'GetHiddenItemnumbers tests' => sub {
Link Here
|
143 |
$dbh->rollback; |
144 |
$dbh->rollback; |
144 |
}; |
145 |
}; |
145 |
|
146 |
|
|
|
147 |
subtest 'GetItemsInfo tests' => sub { |
148 |
|
149 |
plan tests => 3; |
150 |
|
151 |
# Start transaction |
152 |
$dbh->{AutoCommit} = 0; |
153 |
$dbh->{RaiseError} = 1; |
154 |
|
155 |
my $homebranch = 'CPL'; |
156 |
my $holdingbranch = 'MPL'; |
157 |
|
158 |
# Add a biblio |
159 |
my $biblionumber = get_biblio(); |
160 |
# Add an item |
161 |
my ($item_bibnum, $item_bibitemnum, $itemnumber) |
162 |
= AddItem({ |
163 |
homebranch => $homebranch, |
164 |
holdingbranch => $holdingbranch |
165 |
}, $biblionumber ); |
166 |
|
167 |
my $branch = GetBranchDetail( $homebranch ); |
168 |
$branch->{ opac_info } = "homebranch OPAC info"; |
169 |
ModBranch($branch); |
170 |
|
171 |
$branch = GetBranchDetail( $holdingbranch ); |
172 |
$branch->{ opac_info } = "holdingbranch OPAC info"; |
173 |
ModBranch($branch); |
174 |
|
175 |
my @results = GetItemsInfo( $biblionumber ); |
176 |
ok( @results, 'GetItemsInfo returns results'); |
177 |
is( $results[0]->{ home_branch_opac_info }, "homebranch OPAC info", |
178 |
'GetItemsInfo returns the correct home branch OPAC info notice' ); |
179 |
is( $results[0]->{ holding_branch_opac_info }, "holdingbranch OPAC info", |
180 |
'GetItemsInfo returns the correct holding branch OPAC info notice' ); |
181 |
|
182 |
$dbh->rollback; |
183 |
}; |
184 |
|
146 |
subtest q{Test Koha::Database->schema()->resultset('Item')->itemtype()} => sub { |
185 |
subtest q{Test Koha::Database->schema()->resultset('Item')->itemtype()} => sub { |
147 |
|
186 |
|
148 |
plan tests => 2; |
187 |
plan tests => 2; |
149 |
- |
|
|