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

Rebased-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Martin Renvoize 2021-03-15 16:41:41 +00:00 committed by Tomas Cohen Arazi
parent 02670978f3
commit aa8a9f660c
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 7 additions and 7 deletions

View File

@ -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;
@ -317,18 +317,18 @@ 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');
};
$schema->storage->txn_rollback;