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