Bug 24769: Regression tests
authorTomas Cohen Arazi <tomascohen@theke.io>
Mon, 4 May 2020 14:25:35 +0000 (11:25 -0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 5 May 2020 10:03:45 +0000 (11:03 +0100)
When regressions are found, we introduce regression tests :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

t/db_dependent/ILSDI_Services.t
t/db_dependent/SIP/Transaction.t

index fdce3f4..3f25314 100644 (file)
@@ -454,7 +454,7 @@ subtest 'Holds test' => sub {
 
 subtest 'Holds test for branch transfer limits' => sub {
 
-    plan tests => 4;
+    plan tests => 6;
 
     $schema->storage->txn_begin;
 
@@ -536,11 +536,15 @@ subtest 'Holds test for branch transfer limits' => sub {
 
     $reply = C4::ILSDI::Services::HoldItem( $query );
     is( $reply->{code}, undef, "Item hold, Item can be transferred" );
+    my $hold = Koha::Holds->search({ itemnumber => $item->{itemnumber}, borrowernumber => $patron->{borrowernumber} })->next;
+    is( $hold->branchcode, $pickup_branch->{branchcode}, 'The library id is correctly set' );
 
     Koha::Holds->search()->delete();
 
     $reply = C4::ILSDI::Services::HoldTitle( $query );
     is( $reply->{code}, undef, "Record hold, Item con be transferred" );
+    $hold = Koha::Holds->search({ biblionumber => $biblio->{biblionumber}, borrowernumber => $patron->{borrowernumber} })->next;
+    is( $hold->branchcode, $pickup_branch->{branchcode}, 'The library id is correctly set' );
 
     $schema->storage->txn_rollback;
 };
index 6c38eca..cb10003 100755 (executable)
@@ -209,7 +209,7 @@ subtest cancel_hold => sub {
 };
 
 subtest do_hold => sub {
-    plan tests => 7;
+    plan tests => 8;
 
     my $library = $builder->build_object( { class => 'Koha::Libraries' } );
     my $patron_1 = $builder->build_object(
@@ -265,7 +265,9 @@ subtest do_hold => sub {
     my $hold = $transaction->do_hold();
     is( $item->biblio->holds->count(), 2, "Bib has 2 holds" );
 
-    is( $patron_2->holds->next->priority, 2, 'Hold placed from SIP should have a correct priority of 2');
+    my $THE_hold = $patron_2->holds->next;
+    is( $THE_hold->priority, 2, 'Hold placed from SIP should have a correct priority of 2');
+    is( $THE_hold->branchcode, $patron_2->branchcode, 'Hold placed from SIP should have the branchcode set' );
 };
 
 subtest do_checkin => sub {