Lines 1993-1999
subtest 'filter_by_for_hold' => sub {
Link Here
|
1993 |
}; |
1993 |
}; |
1994 |
|
1994 |
|
1995 |
subtest 'filter_by_bookable' => sub { |
1995 |
subtest 'filter_by_bookable' => sub { |
1996 |
plan tests => 2; |
1996 |
plan tests => 3; |
1997 |
|
1997 |
|
1998 |
$schema->storage->txn_begin; |
1998 |
$schema->storage->txn_begin; |
1999 |
|
1999 |
|
Lines 2012-2016
subtest 'filter_by_bookable' => sub {
Link Here
|
2012 |
"the correct item is returned from filter_by_bookable" |
2012 |
"the correct item is returned from filter_by_bookable" |
2013 |
); |
2013 |
); |
2014 |
|
2014 |
|
|
|
2015 |
# unset level booking on item (for itemtype) |
2016 |
t::lib::Mocks::mock_preference( 'item-level_booking', 0 ); |
2017 |
|
2018 |
# test with itemtype directly bookable |
2019 |
my $item_type = $builder->build_object( { class => 'Koha::ItemTypes', value => { bookable => 1 } } ); |
2020 |
my $biblio2 = $builder->build_sample_biblio( { itemtype => $item_type->itemtype } ); |
2021 |
|
2022 |
# bookable items |
2023 |
my $bookable_item3 = $builder->build_sample_item( |
2024 |
{ biblionumber => $biblio2->biblionumber, itype => $item_type->itemtype, bookable => 1 } ); |
2025 |
my $bookable_item4 = $builder->build_sample_item( |
2026 |
{ biblionumber => $biblio2->biblionumber, itype => $item_type->itemtype, bookable => 0 } ); |
2027 |
|
2028 |
# items are bookable even if bookable => 0 on item (due to itemtype bookable => 1) |
2029 |
is( $biblio2->items->filter_by_bookable->count, 2, "filter_by_bookable returns the correct number of items" ); |
2030 |
|
2015 |
$schema->storage->txn_rollback; |
2031 |
$schema->storage->txn_rollback; |
|
|
2032 |
|
2016 |
}; |
2033 |
}; |