use C4::Context;
-use Test::More tests => 57;
+use Test::More tests => 58;
use MARC::Record;
use C4::Biblio;
is( CanItemBeReserved( $borrowernumbers[0], $itemnumber )->{status},
'tooManyReserves', 'Patron cannot reserve item with hold limit of 1, 1 bib level hold placed' );
+ #results should be the same for both ReservesControlBranch settings
+t::lib::Mocks::mock_preference( 'ReservesControlBranch', 'ItemHomeLibrary' );
+is( CanItemBeReserved( $borrowernumbers[0], $itemnumber )->{status},
+ 'tooManyReserves', 'Patron cannot reserve item with hold limit of 1, 1 bib level hold placed' );
+#reset for further tests
+t::lib::Mocks::mock_preference( 'ReservesControlBranch', 'PatronLibrary' );
+
subtest 'Test max_holds per library/patron category' => sub {
plan tests => 6;
subtest 'CanItemBeReserved / holds_per_day tests' => sub {
- plan tests => 9;
+ plan tests => 10;
$schema->storage->txn_begin;
{ status => 'tooManyReserves', limit => 3 },
'Unlimited daily holds, but reached reservesallowed'
);
+ #results should be the same for both ReservesControlBranch settings
+ t::lib::Mocks::mock_preference('ReservesControlBranch', 'ItemHomeLibrary');
+ is_deeply(
+ CanItemBeReserved( $patron->borrowernumber, $itemnumber_3 ),
+ { status => 'tooManyReserves', limit => 3 },
+ 'Unlimited daily holds, but reached reservesallowed'
+ );
$schema->storage->txn_rollback;
};