Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 70; |
20 |
use Test::More tests => 71; |
21 |
use Test::NoWarnings; |
21 |
use Test::NoWarnings; |
22 |
use Test::MockModule; |
22 |
use Test::MockModule; |
23 |
use Test::Warn; |
23 |
use Test::Warn; |
Lines 1351-1356
subtest 'AllowHoldOnPatronPossession test' => sub {
Link Here
|
1351 |
); |
1351 |
); |
1352 |
}; |
1352 |
}; |
1353 |
|
1353 |
|
|
|
1354 |
subtest 'check maxreserve test' => sub { |
1355 |
|
1356 |
plan tests => 2; |
1357 |
|
1358 |
$schema->storage->txn_begin; |
1359 |
t::lib::Mocks::mock_preference('maxreserves', 1); |
1360 |
# Create the items and patrons we need |
1361 |
my $biblio_1 = $builder->build_sample_biblio(); |
1362 |
my $biblio_2 = $builder->build_sample_biblio(); |
1363 |
my $itype = $builder->build_object({ class => "Koha::ItemTypes", value => { notforloan => 0 } }); |
1364 |
my $item_1 = $builder->build_sample_item({ biblionumber => $biblio_1->biblionumber,notforloan => 0, itype => $itype->itemtype }); |
1365 |
my $item_2 = $builder->build_sample_item({ biblionumber => $biblio_2->biblionumber, notforloan => 0, itype => $itype->itemtype }); |
1366 |
my $patron = $builder->build_object({ class => "Koha::Patrons", |
1367 |
value => { branchcode => $item_2->homebranch }}); |
1368 |
|
1369 |
|
1370 |
# Place a hold on the title for both patrons |
1371 |
my $reserve = AddReserve( |
1372 |
{ |
1373 |
branchcode => $item_1->homebranch, |
1374 |
borrowernumber => $patron->borrowernumber, |
1375 |
biblionumber => $biblio_1->biblionumber, |
1376 |
priority => 1, |
1377 |
itemnumber => $item_1->itemnumber, |
1378 |
} |
1379 |
); |
1380 |
|
1381 |
my $borrowernumber = $patron->borrowernumber; |
1382 |
|
1383 |
is( C4::Reserves::CanBookBeReserved($borrowernumber, $biblio_2->biblionumber)->{status} , 'tooManyReserves', "CanBookBeReserved: Reserving more than maxreserves is forbidden"); |
1384 |
is( C4::Reserves::CanItemBeReserved($patron, $item_2, $item_2->homebranch)->{status} , 'tooManyReserves', "CanItemBeReserved: Reserving more than maxreserves is forbidden"); |
1385 |
t::lib::Mocks::mock_preference('maxreserves', 20); |
1386 |
$schema->storage->txn_rollback; |
1387 |
}; |
1388 |
|
1354 |
subtest 'MergeHolds' => sub { |
1389 |
subtest 'MergeHolds' => sub { |
1355 |
|
1390 |
|
1356 |
plan tests => 1; |
1391 |
plan tests => 1; |
1357 |
- |
|
|