Bug 21738: unit tests for HoldTitle
authorAlex Arnaud <alex.arnaud@biblibre.com>
Thu, 7 Feb 2019 16:22:17 +0000 (17:22 +0100)
committerNick Clemens <nick@bywatersolutions.com>
Fri, 8 Feb 2019 20:44:07 +0000 (20:44 +0000)
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

t/db_dependent/ILSDI_Services.t

index 049a8f8..4ec7f81 100644 (file)
@@ -299,7 +299,7 @@ subtest 'LookupPatron test' => sub {
 
 subtest 'Holds test' => sub {
 
-    plan tests => 4;
+    plan tests => 5;
 
     $schema->storage->txn_begin;
 
@@ -350,6 +350,17 @@ subtest 'Holds test' => sub {
     $reply = C4::ILSDI::Services::HoldTitle( $query );
     is( $reply->{code}, 'itemAlreadyOnHold', "Item already on hold" );
 
+    my $biblio_with_no_item = $builder->build({
+        source => 'Biblio',
+    });
+
+    $query = new CGI;
+    $query->param( 'patron_id', $patron->{borrowernumber});
+    $query->param( 'bib_id', $biblio_with_no_item->{biblionumber});
+
+    $reply = C4::ILSDI::Services::HoldTitle( $query );
+    is( $reply->{code}, 'NoItems', 'Biblio has no item' );
+
     my $biblio2 = $builder->build({
         source => 'Biblio',
     });