From ac936d4de149533e2af12f5f39e5957bf15a8c9c Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 5 Oct 2021 14:30:49 +0200 Subject: [PATCH] Bug 3142: Add test for the circ rule Signed-off-by: Marcel de Rooy Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart (cherry picked from commit bd438ff99d593fd42f995229b36548beeefdfeba) Signed-off-by: Andrew Fuerste-Henry --- t/db_dependent/Koha/Items.t | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/Items.t b/t/db_dependent/Koha/Items.t index d9c721b421..b9ea036efe 100755 --- a/t/db_dependent/Koha/Items.t +++ b/t/db_dependent/Koha/Items.t @@ -1471,7 +1471,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' ); @@ -1497,6 +1497,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; }; -- 2.20.1