Bug 35787: Add unit test for filter_by_bookable
Trivial test added for filter_by_bookable Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
bd987c7046
commit
585a5fb927
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
use Modern::Perl;
|
||||
|
||||
use Test::More tests => 16;
|
||||
use Test::More tests => 17;
|
||||
|
||||
use Test::MockModule;
|
||||
use Test::Exception;
|
||||
|
|
@ -2000,3 +2000,26 @@ subtest 'filter_by_for_hold' => sub {
|
|||
|
||||
$schema->storage->txn_rollback;
|
||||
};
|
||||
|
||||
subtest 'filter_by_bookable' => sub {
|
||||
plan tests => 2;
|
||||
|
||||
$schema->storage->txn_begin;
|
||||
|
||||
my $biblio = $builder->build_sample_biblio;
|
||||
|
||||
# bookable items
|
||||
my $bookable_item1 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber, bookable => 1 } );
|
||||
|
||||
# not bookable items
|
||||
my $non_bookable_item1 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber, bookable => 0 } );
|
||||
my $non_bookable_item2 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber, bookable => 0 } );
|
||||
|
||||
is( $biblio->items->filter_by_bookable->count, 1, "filter_by_bookable returns the correct number of items" );
|
||||
is(
|
||||
$biblio->items->filter_by_bookable->next->itemnumber, $bookable_item1->itemnumber,
|
||||
"the correct item is returned from filter_by_bookable"
|
||||
);
|
||||
|
||||
$schema->storage->txn_rollback;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue