Lines 20-25
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 Koha::Database; |
23 |
|
24 |
|
24 |
use Test::More tests => 3; |
25 |
use Test::More tests => 3; |
25 |
|
26 |
|
Lines 142-147
subtest 'GetHiddenItemnumbers tests' => sub {
Link Here
|
142 |
$dbh->rollback; |
143 |
$dbh->rollback; |
143 |
}; |
144 |
}; |
144 |
|
145 |
|
|
|
146 |
subtest q{Test Koha::Database->schema()->resultset('Item')->itemtype()} => sub { |
147 |
|
148 |
plan tests => 2; |
149 |
|
150 |
# Start transaction |
151 |
$dbh->{AutoCommit} = 0; |
152 |
$dbh->{RaiseError} = 1; |
153 |
|
154 |
my $schema = Koha::Database->new()->schema(); |
155 |
|
156 |
my $biblio = |
157 |
$schema->resultset('Biblio')->create( |
158 |
{ |
159 |
title => "Test title", |
160 |
biblioitems => [ |
161 |
{ |
162 |
itemtype => 'BIB_LEVEL', |
163 |
items => [ { itype => "ITEM_LEVEL" } ] |
164 |
} |
165 |
] |
166 |
} |
167 |
); |
168 |
|
169 |
my $biblioitem = $biblio->biblioitem(); |
170 |
my ( $item ) = $biblioitem->items(); |
171 |
|
172 |
C4::Context->set_preference( 'item-level_itypes', 0 ); |
173 |
ok( $item->itemtype() eq 'BIB_LEVEL', '$item->itemtype() returns biblioitem.itemtype when item-level_itypes is disabled' ); |
174 |
|
175 |
C4::Context->set_preference( 'item-level_itypes', 1 ); |
176 |
ok( $item->itemtype() eq 'ITEM_LEVEL', '$item->itemtype() returns items.itype when item-level_itypes is disabled' ); |
177 |
|
178 |
|
179 |
$dbh->rollback; |
180 |
}; |
181 |
|
145 |
# Helper method to set up a Biblio. |
182 |
# Helper method to set up a Biblio. |
146 |
sub get_biblio { |
183 |
sub get_biblio { |
147 |
my $bib = MARC::Record->new(); |
184 |
my $bib = MARC::Record->new(); |
148 |
- |
|
|