From 25d1d22082dd620ca785913554246bada3ba5892 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 21 Jan 2021 14:49:48 +0000 Subject: [PATCH] Bug 24446: (QA follow-up) Fix ModItemTransfer tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Seems I missed passing trigger in the tests for ModItemTransfer. This patch corrects that oversight. Signed-off-by: Kathleen Milne Signed-off-by: Martin Renvoize Signed-off-by: Joonas Kylmälä Signed-off-by: Jonathan Druart --- t/db_dependent/Circulation.t | 3 ++- t/db_dependent/Circulation/transfers.t | 19 +++++++++++++------ t/db_dependent/ILSDI_Services.t | 2 +- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index c82603de1b..d40e586e6b 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -3420,6 +3420,7 @@ subtest 'Cancel transfers on lost items' => sub { from_branch => $library_1->{branchcode}, to_branch => $library_2->{branchcode}, barcode => $item->barcode, + trigger => 'Reserve', }); my $hold = Koha::Holds->find( $reserve_id ); is( $hold->found, 'T', 'Hold is in transit' ); @@ -4682,7 +4683,7 @@ subtest 'Checkout should correctly terminate a transfer' => sub { my $do_transfer = 1; ModItemTransfer( $item->itemnumber, $library_1->branchcode, - $library_2->branchcode ); + $library_2->branchcode, 'Manual' ); ModReserveAffect( $item->itemnumber, undef, $do_transfer, $reserve_id ); GetOtherReserves( $item->itemnumber ) ; # To put the Reason, it's what does returns.pl... diff --git a/t/db_dependent/Circulation/transfers.t b/t/db_dependent/Circulation/transfers.t index 215afad81a..7ad80f31d6 100755 --- a/t/db_dependent/Circulation/transfers.t +++ b/t/db_dependent/Circulation/transfers.t @@ -111,10 +111,12 @@ my $item_id4 = Koha::Item->new( )->store->itemnumber; #Add transfers +my $trigger = 'Manual'; ModItemTransfer( $item_id1, $branchcode_1, - $branchcode_2 + $branchcode_2, + $trigger ); my $item_obj = Koha::Items->find({ itemnumber => $item_id1 }); @@ -123,14 +125,16 @@ is( $item_obj->holdingbranch, $branchcode_1, "Item should be held at branch that ModItemTransfer( $item_id2, $branchcode_1, - $branchcode_2 + $branchcode_2, + $trigger ); # Add an "unsent" transfer for tests ModItemTransfer( $item_id3, $branchcode_1, - $branchcode_2 + $branchcode_2, + $trigger ); my $transfer_requested = Koha::Item::Transfers->search( { itemnumber => $item_id3 }, { rows => 1 })->single; $transfer_requested->set({ daterequested => dt_from_string, datesent => undef })->store; @@ -139,7 +143,8 @@ $transfer_requested->set({ daterequested => dt_from_string, datesent => undef }) ModItemTransfer( $item_id4, $branchcode_1, - $branchcode_2 + $branchcode_2, + $trigger ); my $transfer_cancelled = Koha::Item::Transfers->search( { itemnumber => $item_id4 }, { rows => 1 })->single; $transfer_cancelled->set( { daterequested => dt_from_string, datesent => undef, datecancelled => dt_from_string } )->store; @@ -239,13 +244,15 @@ $dbh->do("DELETE FROM branchtransfers"); ModItemTransfer( $item_id1, $branchcode_1, - $branchcode_2 + $branchcode_2, + $trigger ); my $transfer = Koha::Item::Transfers->search()->next(); ModItemTransfer( $item_id1, $branchcode_1, - $branchcode_2 + $branchcode_2, + $trigger ); $transfer->{_result}->discard_changes; ok( $transfer->datearrived, 'Date arrived is set when new transfer is initiated' ); diff --git a/t/db_dependent/ILSDI_Services.t b/t/db_dependent/ILSDI_Services.t index 3818762e55..37fd3fbdfb 100755 --- a/t/db_dependent/ILSDI_Services.t +++ b/t/db_dependent/ILSDI_Services.t @@ -643,7 +643,7 @@ subtest 'GetRecords' => sub { } }); - ModItemTransfer($item->itemnumber, $branch1->{branchcode}, $branch2->{branchcode}); + ModItemTransfer($item->itemnumber, $branch1->{branchcode}, $branch2->{branchcode}, 'Manual'); my $cgi = CGI->new; $cgi->param(service => 'GetRecords'); -- 2.39.5