|
Lines 7-13
use t::lib::TestBuilder;
Link Here
|
| 7 |
|
7 |
|
| 8 |
use C4::Context; |
8 |
use C4::Context; |
| 9 |
|
9 |
|
| 10 |
use Test::More tests => 57; |
10 |
use Test::More tests => 58; |
| 11 |
use MARC::Record; |
11 |
use MARC::Record; |
| 12 |
use C4::Items; |
12 |
use C4::Items; |
| 13 |
use C4::Biblio; |
13 |
use C4::Biblio; |
|
Lines 415-420
my $res_id = AddReserve( $branch_1, $borrowernumbers[0], $bibnum, '', 1, );
Link Here
|
| 415 |
is( CanItemBeReserved( $borrowernumbers[0], $itemnumber )->{status}, |
415 |
is( CanItemBeReserved( $borrowernumbers[0], $itemnumber )->{status}, |
| 416 |
'tooManyReserves', 'Patron cannot reserve item with hold limit of 1, 1 bib level hold placed' ); |
416 |
'tooManyReserves', 'Patron cannot reserve item with hold limit of 1, 1 bib level hold placed' ); |
| 417 |
|
417 |
|
|
|
418 |
#results should be the same for both ReservesControlBranch settings |
| 419 |
t::lib::Mocks::mock_preference( 'ReservesControlBranch', 'ItemHomeLibrary' ); |
| 420 |
is( CanItemBeReserved( $borrowernumbers[0], $itemnumber )->{status}, |
| 421 |
'tooManyReserves', 'Patron cannot reserve item with hold limit of 1, 1 bib level hold placed' ); |
| 422 |
#reset for further tests |
| 423 |
t::lib::Mocks::mock_preference( 'ReservesControlBranch', 'PatronLibrary' ); |
| 424 |
|
| 418 |
subtest 'Test max_holds per library/patron category' => sub { |
425 |
subtest 'Test max_holds per library/patron category' => sub { |
| 419 |
plan tests => 6; |
426 |
plan tests => 6; |
| 420 |
|
427 |
|
|
Lines 523-529
$schema->storage->txn_rollback;
Link Here
|
| 523 |
|
530 |
|
| 524 |
subtest 'CanItemBeReserved / holds_per_day tests' => sub { |
531 |
subtest 'CanItemBeReserved / holds_per_day tests' => sub { |
| 525 |
|
532 |
|
| 526 |
plan tests => 9; |
533 |
plan tests => 10; |
| 527 |
|
534 |
|
| 528 |
$schema->storage->txn_begin; |
535 |
$schema->storage->txn_begin; |
| 529 |
|
536 |
|
|
Lines 643-648
subtest 'CanItemBeReserved / holds_per_day tests' => sub {
Link Here
|
| 643 |
{ status => 'tooManyReserves', limit => 3 }, |
650 |
{ status => 'tooManyReserves', limit => 3 }, |
| 644 |
'Unlimited daily holds, but reached reservesallowed' |
651 |
'Unlimited daily holds, but reached reservesallowed' |
| 645 |
); |
652 |
); |
|
|
653 |
#results should be the same for both ReservesControlBranch settings |
| 654 |
t::lib::Mocks::mock_preference('ReservesControlBranch', 'ItemHomeLibrary'); |
| 655 |
is_deeply( |
| 656 |
CanItemBeReserved( $patron->borrowernumber, $itemnumber_3 ), |
| 657 |
{ status => 'tooManyReserves', limit => 3 }, |
| 658 |
'Unlimited daily holds, but reached reservesallowed' |
| 659 |
); |
| 646 |
|
660 |
|
| 647 |
$schema->storage->txn_rollback; |
661 |
$schema->storage->txn_rollback; |
| 648 |
}; |
662 |
}; |
| 649 |
- |
|
|