Lines 2078-2084
subtest 'filter_by_for_hold' => sub {
Link Here
|
2078 |
}; |
2078 |
}; |
2079 |
|
2079 |
|
2080 |
subtest 'filter_by_bookable' => sub { |
2080 |
subtest 'filter_by_bookable' => sub { |
2081 |
plan tests => 2; |
2081 |
plan tests => 3; |
2082 |
|
2082 |
|
2083 |
$schema->storage->txn_begin; |
2083 |
$schema->storage->txn_begin; |
2084 |
|
2084 |
|
Lines 2097-2101
subtest 'filter_by_bookable' => sub {
Link Here
|
2097 |
"the correct item is returned from filter_by_bookable" |
2097 |
"the correct item is returned from filter_by_bookable" |
2098 |
); |
2098 |
); |
2099 |
|
2099 |
|
|
|
2100 |
# unset level booking on item (for itemtype) |
2101 |
t::lib::Mocks::mock_preference( 'item-level_booking', 0 ); |
2102 |
|
2103 |
# test with itemtype directly bookable |
2104 |
my $item_type = $builder->build_object( { class => 'Koha::ItemTypes', value => { bookable => 1 } } ); |
2105 |
my $biblio2 = $builder->build_sample_biblio( { itemtype => $item_type->itemtype } ); |
2106 |
|
2107 |
# bookable items |
2108 |
my $bookable_item3 = $builder->build_sample_item( |
2109 |
{ biblionumber => $biblio2->biblionumber, itype => $item_type->itemtype, bookable => 1 } ); |
2110 |
my $bookable_item4 = $builder->build_sample_item( |
2111 |
{ biblionumber => $biblio2->biblionumber, itype => $item_type->itemtype, bookable => 0 } ); |
2112 |
|
2113 |
# items are bookable even if bookable => 0 on item (due to itemtype bookable => 1) |
2114 |
is( $biblio2->items->filter_by_bookable->count, 2, "filter_by_bookable returns the correct number of items" ); |
2115 |
|
2100 |
$schema->storage->txn_rollback; |
2116 |
$schema->storage->txn_rollback; |
|
|
2117 |
|
2101 |
}; |
2118 |
}; |