|
Lines 19-25
use Modern::Perl;
Link Here
|
| 19 |
|
19 |
|
| 20 |
use CGI qw ( -utf8 ); |
20 |
use CGI qw ( -utf8 ); |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 9; |
22 |
use Test::More tests => 10; |
| 23 |
use Test::MockModule; |
23 |
use Test::MockModule; |
| 24 |
use t::lib::Mocks; |
24 |
use t::lib::Mocks; |
| 25 |
use t::lib::TestBuilder; |
25 |
use t::lib::TestBuilder; |
|
Lines 547-552
subtest 'Holds test for branch transfer limits' => sub {
Link Here
|
| 547 |
$schema->storage->txn_rollback; |
547 |
$schema->storage->txn_rollback; |
| 548 |
}; |
548 |
}; |
| 549 |
|
549 |
|
|
|
550 |
subtest 'Holds test with start_date and end_date' => sub { |
| 551 |
|
| 552 |
plan tests => 8; |
| 553 |
|
| 554 |
$schema->storage->txn_begin; |
| 555 |
|
| 556 |
my $pickup_branch = $builder->build( |
| 557 |
{ |
| 558 |
source => 'Branch', |
| 559 |
value => { |
| 560 |
pickup_location => 1, |
| 561 |
} |
| 562 |
} |
| 563 |
); |
| 564 |
|
| 565 |
my $patron = $builder->build({ |
| 566 |
source => 'Borrower', |
| 567 |
}); |
| 568 |
|
| 569 |
my $biblio = $builder->build({ |
| 570 |
source => 'Biblio', |
| 571 |
}); |
| 572 |
|
| 573 |
my $biblioitems = $builder->build({ |
| 574 |
source => 'Biblioitem', |
| 575 |
value => { |
| 576 |
biblionumber => $biblio->{biblionumber}, |
| 577 |
} |
| 578 |
}); |
| 579 |
|
| 580 |
my $item = $builder->build({ |
| 581 |
source => 'Item', |
| 582 |
value => { |
| 583 |
homebranch => $pickup_branch->{branchcode}, |
| 584 |
holdingbranch => $pickup_branch->{branchcode}, |
| 585 |
biblionumber => $biblio->{biblionumber}, |
| 586 |
damaged => 0, |
| 587 |
} |
| 588 |
}); |
| 589 |
|
| 590 |
Koha::CirculationRules->set_rule( |
| 591 |
{ |
| 592 |
categorycode => undef, |
| 593 |
itemtype => undef, |
| 594 |
branchcode => undef, |
| 595 |
rule_name => 'reservesallowed', |
| 596 |
rule_value => 99, |
| 597 |
} |
| 598 |
); |
| 599 |
|
| 600 |
my $query = new CGI; |
| 601 |
$query->param( 'pickup_location', $pickup_branch->{branchcode} ); |
| 602 |
$query->param( 'patron_id', $patron->{borrowernumber}); |
| 603 |
$query->param( 'bib_id', $biblio->{biblionumber}); |
| 604 |
$query->param( 'item_id', $item->{itemnumber}); |
| 605 |
$query->param( 'start_date', '2020-03-20'); |
| 606 |
$query->param( 'expiry_date', '2020-04-22'); |
| 607 |
|
| 608 |
my $reply = C4::ILSDI::Services::HoldItem( $query ); |
| 609 |
is ($reply->{pickup_location}, $pickup_branch->{branchname}, "Item hold with date parameters was placed"); |
| 610 |
my $hold = Koha::Holds->search({ biblionumber => $biblio->{biblionumber}})->next(); |
| 611 |
use Data::Dumper; |
| 612 |
print Dumper($hold); |
| 613 |
is( $hold->biblionumber, $biblio->{biblionumber}, "correct biblionumber"); |
| 614 |
is( $hold->reservedate, '2020-03-20', "Item hold has correct start date" ); |
| 615 |
is( $hold->expirationdate, '2020-04-22', "Item hold has correct end date" ); |
| 616 |
|
| 617 |
$hold->delete(); |
| 618 |
|
| 619 |
$reply = C4::ILSDI::Services::HoldTitle( $query ); |
| 620 |
is ($reply->{pickup_location}, $pickup_branch->{branchname}, "Record hold with date parameters was placed"); |
| 621 |
$hold = Koha::Holds->search({ biblionumber => $biblio->{biblionumber}})->next(); |
| 622 |
is( $hold->biblionumber, $biblio->{biblionumber}, "correct biblionumber"); |
| 623 |
is( $hold->reservedate, '2020-03-20', "Record hold has correct start date" ); |
| 624 |
is( $hold->expirationdate, '2020-04-22', "Record hold has correct end date" ); |
| 625 |
|
| 626 |
$schema->storage->txn_rollback; |
| 627 |
}; |
| 628 |
|
| 550 |
subtest 'GetRecords' => sub { |
629 |
subtest 'GetRecords' => sub { |
| 551 |
|
630 |
|
| 552 |
plan tests => 1; |
631 |
plan tests => 1; |
| 553 |
- |
|
|