Bug 3142: Add test for the circ rule

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2021-10-05 14:30:49 +02:00
parent 70a303a5de
commit bd438ff99d
1 changed files with 18 additions and 1 deletions

View File

@ -1510,7 +1510,7 @@ subtest 'can_be_transferred' => sub {
};
subtest 'filter_by_for_hold' => sub {
plan tests => 8;
plan tests => 9;
my $biblio = $builder->build_sample_biblio;
is( $biblio->items->filter_by_for_hold->count, 0, 'no item yet' );
@ -1536,6 +1536,23 @@ subtest 'filter_by_for_hold' => sub {
t::lib::Mocks::mock_preference('AllowHoldsOnDamagedItems', 1);
is( $biblio->items->filter_by_for_hold->count, 6, '6 items for hold - damaged if AllowHoldsOnDamagedItems' );
my $not_holdable_itemtype = $builder->build_object({ class => 'Koha::ItemTypes' })->itemtype;
$builder->build_sample_item(
{
biblionumber => $biblio->biblionumber,
itype => $not_holdable_itemtype,
}
);
Koha::CirculationRules->set_rule(
{
branchcode => undef,
itemtype => $not_holdable_itemtype,
rule_name => 'holdallowed',
rule_value => 'not_allowed',
}
);
is( $biblio->items->filter_by_for_hold->count, 6, '6 items for hold - holdallowed=not_allowed' );
$biblio->delete;
};