|
Lines 2002-2008
subtest 'filter_by_for_hold' => sub {
Link Here
|
| 2002 |
}; |
2002 |
}; |
| 2003 |
|
2003 |
|
| 2004 |
subtest 'filter_by_bookable' => sub { |
2004 |
subtest 'filter_by_bookable' => sub { |
| 2005 |
plan tests => 2; |
2005 |
plan tests => 3; |
| 2006 |
|
2006 |
|
| 2007 |
$schema->storage->txn_begin; |
2007 |
$schema->storage->txn_begin; |
| 2008 |
|
2008 |
|
|
Lines 2021-2025
subtest 'filter_by_bookable' => sub {
Link Here
|
| 2021 |
"the correct item is returned from filter_by_bookable" |
2021 |
"the correct item is returned from filter_by_bookable" |
| 2022 |
); |
2022 |
); |
| 2023 |
|
2023 |
|
|
|
2024 |
# unset level booking on item (for itemtype) |
| 2025 |
t::lib::Mocks::mock_preference( 'item-level_booking', 0 ); |
| 2026 |
|
| 2027 |
# test with itemtype directly bookable |
| 2028 |
my $item_type = $builder->build_object( { class => 'Koha::ItemTypes', value => { bookable => 1 } } ); |
| 2029 |
my $biblio2 = $builder->build_sample_biblio( { itemtype => $item_type->itemtype } ); |
| 2030 |
|
| 2031 |
# bookable items |
| 2032 |
my $bookable_item3 = $builder->build_sample_item( |
| 2033 |
{ biblionumber => $biblio2->biblionumber, itype => $item_type->itemtype, bookable => 1 } ); |
| 2034 |
my $bookable_item4 = $builder->build_sample_item( |
| 2035 |
{ biblionumber => $biblio2->biblionumber, itype => $item_type->itemtype, bookable => 0 } ); |
| 2036 |
|
| 2037 |
# items are bookable even if bookable => 0 on item (due to itemtype bookable => 1) |
| 2038 |
is( $biblio2->items->filter_by_bookable->count, 2, "filter_by_bookable returns the correct number of items" ); |
| 2039 |
|
| 2024 |
$schema->storage->txn_rollback; |
2040 |
$schema->storage->txn_rollback; |
|
|
2041 |
|
| 2025 |
}; |
2042 |
}; |