Bug 24860: (QA follow-up) Add unit tests to cover changes to Reserves.pm

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Kyle Hall 2022-10-12 13:04:38 -04:00 committed by Tomas Cohen Arazi
parent bba8c76011
commit e1b9755808
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -7,7 +7,7 @@ use t::lib::TestBuilder;
use C4::Context;
use Test::More tests => 75;
use Test::More tests => 76;
use Test::Exception;
use MARC::Record;
@ -384,6 +384,12 @@ t::lib::Mocks::mock_preference( 'SkipHoldTrapOnNotForLoanValue', '-1' );
ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for item with notforloan value matching SkipHoldTrapOnNotForLoanValue" );
t::lib::Mocks::mock_preference( 'SkipHoldTrapOnNotForLoanValue', '-1|1' );
ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for item with notforloan value matching SkipHoldTrapOnNotForLoanValue" );
t::lib::Mocks::mock_preference( 'SkipHoldTrapOnNotForLoanValue', '' );
my $item_group_1 = Koha::Biblio::ItemGroup->new( { biblio_id => $biblio->id } )->store();
my $item_group_2 = Koha::Biblio::ItemGroup->new( { biblio_id => $biblio->id } )->store();
$item_group_1->add_item({ item_id => $itemnumber });
$hold->item_group_id( $item_group_2->id )->update;
ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for item with non-matching item group" );
is(
CanItemBeReserved( $patrons[0], $nfl_item)->{status}, 'itemAlreadyOnHold',
"cannot request item that you have already reservedd"