Lines 2112-2118
subtest 'filter_by_for_hold' => sub {
Link Here
|
2112 |
}; |
2112 |
}; |
2113 |
|
2113 |
|
2114 |
subtest 'filter_by_bookable' => sub { |
2114 |
subtest 'filter_by_bookable' => sub { |
2115 |
plan tests => 2; |
2115 |
plan tests => 3; |
2116 |
|
2116 |
|
2117 |
$schema->storage->txn_begin; |
2117 |
$schema->storage->txn_begin; |
2118 |
|
2118 |
|
Lines 2131-2135
subtest 'filter_by_bookable' => sub {
Link Here
|
2131 |
"the correct item is returned from filter_by_bookable" |
2131 |
"the correct item is returned from filter_by_bookable" |
2132 |
); |
2132 |
); |
2133 |
|
2133 |
|
|
|
2134 |
# unset level booking on item (for itemtype) |
2135 |
t::lib::Mocks::mock_preference( 'item-level_booking', 0 ); |
2136 |
|
2137 |
# test with itemtype directly bookable |
2138 |
my $item_type = $builder->build_object( { class => 'Koha::ItemTypes', value => { bookable => 1 } } ); |
2139 |
my $biblio2 = $builder->build_sample_biblio( { itemtype => $item_type->itemtype } ); |
2140 |
|
2141 |
# bookable items |
2142 |
my $bookable_item3 = $builder->build_sample_item( |
2143 |
{ biblionumber => $biblio2->biblionumber, itype => $item_type->itemtype, bookable => 1 } ); |
2144 |
my $bookable_item4 = $builder->build_sample_item( |
2145 |
{ biblionumber => $biblio2->biblionumber, itype => $item_type->itemtype, bookable => 0 } ); |
2146 |
|
2147 |
# items are bookable even if bookable => 0 on item (due to itemtype bookable => 1) |
2148 |
is( $biblio2->items->filter_by_bookable->count, 2, "filter_by_bookable returns the correct number of items" ); |
2149 |
|
2134 |
$schema->storage->txn_rollback; |
2150 |
$schema->storage->txn_rollback; |
|
|
2151 |
|
2135 |
}; |
2152 |
}; |