|
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 |
|
12 |
|
| 13 |
use C4::Biblio; |
13 |
use C4::Biblio; |
|
Lines 413-418
my $res_id = AddReserve( $branch_1, $borrowernumbers[0], $biblio->biblionumber,
Link Here
|
| 413 |
is( CanItemBeReserved( $borrowernumbers[0], $itemnumber )->{status}, |
413 |
is( CanItemBeReserved( $borrowernumbers[0], $itemnumber )->{status}, |
| 414 |
'tooManyReserves', 'Patron cannot reserve item with hold limit of 1, 1 bib level hold placed' ); |
414 |
'tooManyReserves', 'Patron cannot reserve item with hold limit of 1, 1 bib level hold placed' ); |
| 415 |
|
415 |
|
|
|
416 |
#results should be the same for both ReservesControlBranch settings |
| 417 |
t::lib::Mocks::mock_preference( 'ReservesControlBranch', 'ItemHomeLibrary' ); |
| 418 |
is( CanItemBeReserved( $borrowernumbers[0], $itemnumber )->{status}, |
| 419 |
'tooManyReserves', 'Patron cannot reserve item with hold limit of 1, 1 bib level hold placed' ); |
| 420 |
#reset for further tests |
| 421 |
t::lib::Mocks::mock_preference( 'ReservesControlBranch', 'PatronLibrary' ); |
| 422 |
|
| 416 |
subtest 'Test max_holds per library/patron category' => sub { |
423 |
subtest 'Test max_holds per library/patron category' => sub { |
| 417 |
plan tests => 6; |
424 |
plan tests => 6; |
| 418 |
|
425 |
|
|
Lines 533-539
$schema->storage->txn_rollback;
Link Here
|
| 533 |
|
540 |
|
| 534 |
subtest 'CanItemBeReserved / holds_per_day tests' => sub { |
541 |
subtest 'CanItemBeReserved / holds_per_day tests' => sub { |
| 535 |
|
542 |
|
| 536 |
plan tests => 9; |
543 |
plan tests => 10; |
| 537 |
|
544 |
|
| 538 |
$schema->storage->txn_begin; |
545 |
$schema->storage->txn_begin; |
| 539 |
|
546 |
|
|
Lines 653-658
subtest 'CanItemBeReserved / holds_per_day tests' => sub {
Link Here
|
| 653 |
{ status => 'tooManyReserves', limit => 3 }, |
660 |
{ status => 'tooManyReserves', limit => 3 }, |
| 654 |
'Unlimited daily holds, but reached reservesallowed' |
661 |
'Unlimited daily holds, but reached reservesallowed' |
| 655 |
); |
662 |
); |
|
|
663 |
#results should be the same for both ReservesControlBranch settings |
| 664 |
t::lib::Mocks::mock_preference('ReservesControlBranch', 'ItemHomeLibrary'); |
| 665 |
is_deeply( |
| 666 |
CanItemBeReserved( $patron->borrowernumber, $itemnumber_3 ), |
| 667 |
{ status => 'tooManyReserves', limit => 3 }, |
| 668 |
'Unlimited daily holds, but reached reservesallowed' |
| 669 |
); |
| 656 |
|
670 |
|
| 657 |
$schema->storage->txn_rollback; |
671 |
$schema->storage->txn_rollback; |
| 658 |
}; |
672 |
}; |
| 659 |
- |
|
|