|
Lines 302-308
subtest 'LookupPatron test' => sub {
Link Here
|
| 302 |
|
302 |
|
| 303 |
subtest 'Holds test' => sub { |
303 |
subtest 'Holds test' => sub { |
| 304 |
|
304 |
|
| 305 |
plan tests => 5; |
305 |
plan tests => 7; |
| 306 |
|
306 |
|
| 307 |
$schema->storage->txn_begin; |
307 |
$schema->storage->txn_begin; |
| 308 |
|
308 |
|
|
Lines 419-424
subtest 'Holds test' => sub {
Link Here
|
| 419 |
source => 'Item', |
419 |
source => 'Item', |
| 420 |
value => { |
420 |
value => { |
| 421 |
biblionumber => $biblio3->{biblionumber}, |
421 |
biblionumber => $biblio3->{biblionumber}, |
|
|
422 |
barcode => '123456789', |
| 422 |
damaged => 0, |
423 |
damaged => 0, |
| 423 |
itype => $builder->build_object({ class => 'Koha::ItemTypes' })->itemtype, |
424 |
itype => $builder->build_object({ class => 'Koha::ItemTypes' })->itemtype, |
| 424 |
} |
425 |
} |
|
Lines 451-456
subtest 'Holds test' => sub {
Link Here
|
| 451 |
$reply = C4::ILSDI::Services::HoldItem( $query ); |
452 |
$reply = C4::ILSDI::Services::HoldItem( $query ); |
| 452 |
is( $reply->{code}, 'damaged', "Item is damaged" ); |
453 |
is( $reply->{code}, 'damaged', "Item is damaged" ); |
| 453 |
|
454 |
|
|
|
455 |
$patron = $builder->build_object({ class => 'Koha::Patrons' }); |
| 456 |
my $module = new Test::MockModule('C4::Context'); |
| 457 |
$module->mock('userenv', sub { { patron => $patron } }); |
| 458 |
my $date_due = DateTime->now->add(weeks => 2); |
| 459 |
my $issue = C4::Circulation::AddIssue($patron->unblessed, $item3->{barcode}, $date_due); |
| 460 |
t::lib::Mocks::mock_preference( 'AllowHoldsOnPatronsPossessions', '0' ); |
| 461 |
|
| 462 |
$query->param( 'patron_id', $patron->borrowernumber); |
| 463 |
$query->param( 'bib_id', $biblio3->{biblionumber}); |
| 464 |
$query->param( 'item_id', $item3->{itemnumber}); |
| 465 |
$reply = C4::ILSDI::Services::HoldItem( $query ); |
| 466 |
|
| 467 |
is( $reply->{code}, 'itemAlreadyOnLoan', "Patron has issued same book" ); |
| 468 |
is( $reply->{pickup_location}, undef, "No reserve placed"); |
| 469 |
|
| 454 |
$schema->storage->txn_rollback; |
470 |
$schema->storage->txn_rollback; |
| 455 |
}; |
471 |
}; |
| 456 |
|
472 |
|
| 457 |
- |
|
|