From 9d3d2f9fe99c2e8c2568563f28acfcc55364fb9e Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 4 May 2020 11:25:35 -0300 Subject: [PATCH] Bug 24769: Regression tests When regressions are found, we introduce regression tests :-D Signed-off-by: Tomas Cohen Arazi --- t/db_dependent/ILSDI_Services.t | 6 +++++- t/db_dependent/SIP/Transaction.t | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/t/db_dependent/ILSDI_Services.t b/t/db_dependent/ILSDI_Services.t index fdce3f4a0b..3f253149e3 100644 --- a/t/db_dependent/ILSDI_Services.t +++ b/t/db_dependent/ILSDI_Services.t @@ -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; }; diff --git a/t/db_dependent/SIP/Transaction.t b/t/db_dependent/SIP/Transaction.t index 6c38ecad49..cb10003c42 100755 --- a/t/db_dependent/SIP/Transaction.t +++ b/t/db_dependent/SIP/Transaction.t @@ -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 { -- 2.26.2