From c10f320d7f90dfede3f3bca0b5c02669fe913b1d Mon Sep 17 00:00:00 2001
From: Alex Arnaud <alex.arnaud@biblibre.com>
Date: Tue, 18 Sep 2018 12:59:26 +0000
Subject: [PATCH] Bug 19945: Add a test proving that using CanBookBeReserved in
ILSDI::HoldItem is wrong.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
---
t/db_dependent/ILSDI_Services.t | 48 ++++++++++++++++++++++++++++++++-
1 file changed, 47 insertions(+), 1 deletion(-)
diff --git a/t/db_dependent/ILSDI_Services.t b/t/db_dependent/ILSDI_Services.t
index 6891660d31..049a8f8635 100644
--- a/t/db_dependent/ILSDI_Services.t
+++ b/t/db_dependent/ILSDI_Services.t
@@ -299,7 +299,7 @@ subtest 'LookupPatron test' => sub {
subtest 'Holds test' => sub {
- plan tests => 3;
+ plan tests => 4;
$schema->storage->txn_begin;
@@ -388,5 +388,51 @@ subtest 'Holds test' => sub {
$reply = C4::ILSDI::Services::HoldItem( $query );
is( $reply->{code}, 'tooManyReserves', "Too many reserves" );
+ my $biblio3 = $builder->build({
+ source => 'Biblio',
+ });
+
+ my $biblioitems3 = $builder->build({
+ source => 'Biblioitem',
+ value => {
+ biblionumber => $biblio3->{biblionumber},
+ }
+ });
+
+ # Adding a holdable item to biblio 3.
+ my $item3 = $builder->build({
+ source => 'Item',
+ value => {
+ biblionumber => $biblio3->{biblionumber},
+ damaged => 0,
+ }
+ });
+
+ my $item4 = $builder->build({
+ source => 'Item',
+ value => {
+ biblionumber => $biblio3->{biblionumber},
+ damaged => 1,
+ }
+ });
+
+ my $issuingrule2 = $builder->build({
+ source => 'Issuingrule',
+ value => {
+ categorycode => $patron->{categorycode},
+ itemtype => $item3->{itype},
+ branchcode => $patron->{branchcode},
+ reservesallowed => 10,
+ }
+ });
+
+ $query = new CGI;
+ $query->param( 'patron_id', $patron->{borrowernumber});
+ $query->param( 'bib_id', $biblio3->{biblionumber});
+ $query->param( 'item_id', $item4->{itemnumber});
+
+ $reply = C4::ILSDI::Services::HoldItem( $query );
+ is( $reply->{code}, 'damaged', "Item is damaged" );
+
$schema->storage->txn_rollback;
};
--
2.17.2 (Apple Git-113)