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