Bug 35906: Add unit test

Signed-off-by: Esther <esther@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Thibaud Guillot 2024-02-23 10:00:01 +01:00 committed by Katrin Fischer
parent 39891095a6
commit 8dde2730a5
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
2 changed files with 19 additions and 1 deletions

View File

@ -2176,7 +2176,7 @@ subtest 'filter_by_for_hold' => sub {
};
subtest 'filter_by_bookable' => sub {
plan tests => 2;
plan tests => 3;
$schema->storage->txn_begin;
@ -2195,5 +2195,22 @@ subtest 'filter_by_bookable' => sub {
"the correct item is returned from filter_by_bookable"
);
# unset level booking on item (for itemtype)
t::lib::Mocks::mock_preference( 'item-level_booking', 0 );
# test with itemtype directly bookable
my $item_type = $builder->build_object( { class => 'Koha::ItemTypes', value => { bookable => 1 } } );
my $biblio2 = $builder->build_sample_biblio( { itemtype => $item_type->itemtype } );
# bookable items
my $bookable_item3 = $builder->build_sample_item(
{ biblionumber => $biblio2->biblionumber, itype => $item_type->itemtype, bookable => 1 } );
my $bookable_item4 = $builder->build_sample_item(
{ biblionumber => $biblio2->biblionumber, itype => $item_type->itemtype, bookable => 0 } );
# items are bookable even if bookable => 0 on item (due to itemtype bookable => 1)
is( $biblio2->items->filter_by_bookable->count, 2, "filter_by_bookable returns the correct number of items" );
$schema->storage->txn_rollback;
};

View File

@ -638,6 +638,7 @@ sub _gen_default_values {
defaultreplacecost => 0,
processfee => 0,
notforloan => 0,
bookable => 0,
},
Aqbookseller => {
tax_rate => 0,