From a3b30447e201e39ac9a957ba4b6046f56eb510fb Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 15 Mar 2021 16:41:41 +0000 Subject: [PATCH] Bug 24295: Replace mock in t/db_dependent/Circulation/transferbook.t Replace the call to GetTransfers with the get_transfer method in Koha::Item in transferbook.t Test plan 1/ Run t/db_dependent/Circulation/transferbook.t 2/ Confirm it passes 3/ Apply patch 4/ Repeat steps 1-2 --- t/db_dependent/Circulation/transferbook.t | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/t/db_dependent/Circulation/transferbook.t b/t/db_dependent/Circulation/transferbook.t index 84756a82b8..d5051f910e 100755 --- a/t/db_dependent/Circulation/transferbook.t +++ b/t/db_dependent/Circulation/transferbook.t @@ -21,7 +21,7 @@ use Test::More tests => 6; use t::lib::TestBuilder; use t::lib::Mocks; -use C4::Circulation qw( transferbook AddIssue GetTransfers ); +use C4::Circulation qw( transferbook AddIssue ); use C4::Reserves qw( AddReserve ); use Koha::DateUtils qw( dt_from_string ); use Koha::Item::Transfers; @@ -287,17 +287,17 @@ subtest 'transferbook test from branch' => sub { barcode => $item->barcode, trigger => "Manual" }); - my ($datesent,$from_branch,$to_branch) = GetTransfers($item->itemnumber); - is( $from_branch, $library->branchcode, 'The transfer is initiated from the specified branch, not the items home or holdingbranch'); - is( $to_branch, $item->homebranch, 'The transfer is initiated to the specified branch'); + my $transfer = $item->get_transfer; + is( $transfer->frombranch, $library->branchcode, 'The transfer is initiated from the specified branch, not the items home or holdingbranch'); + is( $transfer->tobranch, $item->homebranch, 'The transfer is initiated to the specified branch'); C4::Circulation::transferbook({ from_branch => $item->homebranch, to_branch => $library->branchcode, barcode => $item->barcode, trigger => "Manual" }); - ($datesent,$from_branch,$to_branch) = GetTransfers($item->itemnumber); - is( $from_branch, $item->homebranch, 'The transfer is initiated from the specified branch'); - is( $to_branch, $library->branchcode, 'The transfer is initiated to the specified branch'); + $transfer = $item->get_transfer; + is( $transfer->frombranch, $item->homebranch, 'The transfer is initiated from the specified branch'); + is( $transfer->tobranch, $library->branchcode, 'The transfer is initiated to the specified branch'); }; -- 2.20.1