Lines 2176-2182
subtest 'filter_by_for_hold' => sub {
Link Here
|
2176 |
}; |
2176 |
}; |
2177 |
|
2177 |
|
2178 |
subtest 'filter_by_bookable' => sub { |
2178 |
subtest 'filter_by_bookable' => sub { |
2179 |
plan tests => 2; |
2179 |
plan tests => 3; |
2180 |
|
2180 |
|
2181 |
$schema->storage->txn_begin; |
2181 |
$schema->storage->txn_begin; |
2182 |
|
2182 |
|
Lines 2195-2199
subtest 'filter_by_bookable' => sub {
Link Here
|
2195 |
"the correct item is returned from filter_by_bookable" |
2195 |
"the correct item is returned from filter_by_bookable" |
2196 |
); |
2196 |
); |
2197 |
|
2197 |
|
|
|
2198 |
# unset level booking on item (for itemtype) |
2199 |
t::lib::Mocks::mock_preference( 'item-level_booking', 0 ); |
2200 |
|
2201 |
# test with itemtype directly bookable |
2202 |
my $item_type = $builder->build_object( { class => 'Koha::ItemTypes', value => { bookable => 1 } } ); |
2203 |
my $biblio2 = $builder->build_sample_biblio( { itemtype => $item_type->itemtype } ); |
2204 |
|
2205 |
# bookable items |
2206 |
my $bookable_item3 = $builder->build_sample_item( |
2207 |
{ biblionumber => $biblio2->biblionumber, itype => $item_type->itemtype, bookable => 1 } ); |
2208 |
my $bookable_item4 = $builder->build_sample_item( |
2209 |
{ biblionumber => $biblio2->biblionumber, itype => $item_type->itemtype, bookable => 0 } ); |
2210 |
|
2211 |
# items are bookable even if bookable => 0 on item (due to itemtype bookable => 1) |
2212 |
is( $biblio2->items->filter_by_bookable->count, 2, "filter_by_bookable returns the correct number of items" ); |
2213 |
|
2198 |
$schema->storage->txn_rollback; |
2214 |
$schema->storage->txn_rollback; |
|
|
2215 |
|
2199 |
}; |
2216 |
}; |