Lines 18-24
Link Here
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
use utf8; |
19 |
use utf8; |
20 |
|
20 |
|
21 |
use Test::More tests => 48; |
21 |
use Test::More tests => 49; |
22 |
use Test::Exception; |
22 |
use Test::Exception; |
23 |
use Test::MockModule; |
23 |
use Test::MockModule; |
24 |
use Test::Deep qw( cmp_deeply ); |
24 |
use Test::Deep qw( cmp_deeply ); |
Lines 4036-4041
subtest 'transferbook tests' => sub {
Link Here
|
4036 |
|
4036 |
|
4037 |
}; |
4037 |
}; |
4038 |
|
4038 |
|
|
|
4039 |
subtest 'Checkout should correctly terminate a transfer' => sub { |
4040 |
plan tests => 7; |
4041 |
|
4042 |
my $library_1 = $builder->build_object( { class => 'Koha::Libraries' } ); |
4043 |
my $patron_1 = $builder->build_object( |
4044 |
{ |
4045 |
class => 'Koha::Patrons', |
4046 |
value => { branchcode => $library_1->branchcode } |
4047 |
} |
4048 |
); |
4049 |
my $library_2 = $builder->build_object( { class => 'Koha::Libraries' } ); |
4050 |
my $patron_2 = $builder->build_object( |
4051 |
{ |
4052 |
class => 'Koha::Patrons', |
4053 |
value => { branchcode => $library_2->branchcode } |
4054 |
} |
4055 |
); |
4056 |
|
4057 |
my $item = $builder->build_sample_item( |
4058 |
{ |
4059 |
library => $library_1->branchcode, |
4060 |
} |
4061 |
); |
4062 |
|
4063 |
t::lib::Mocks::mock_userenv( { branchcode => $library_1->branchcode } ); |
4064 |
my $reserve_id = AddReserve( |
4065 |
{ |
4066 |
branchcode => $library_2->branchcode, |
4067 |
borrowernumber => $patron_2->borrowernumber, |
4068 |
biblionumber => $item->biblionumber, |
4069 |
itemnumber => $item->itemnumber, |
4070 |
priority => 1, |
4071 |
} |
4072 |
); |
4073 |
|
4074 |
my $do_transfer = 1; |
4075 |
ModItemTransfer( $item->itemnumber, $library_1->branchcode, |
4076 |
$library_2->branchcode ); |
4077 |
ModReserveAffect( $item->itemnumber, undef, $do_transfer, $reserve_id ); |
4078 |
GetOtherReserves( $item->itemnumber ) |
4079 |
; # To put the Reason, it's what does returns.pl... |
4080 |
my $hold = Koha::Holds->find($reserve_id); |
4081 |
is( $hold->found, 'T', 'Hold is in transit' ); |
4082 |
my $transfer = $item->get_transfer; |
4083 |
is( $transfer->frombranch, $library_1->branchcode ); |
4084 |
is( $transfer->tobranch, $library_2->branchcode ); |
4085 |
is( $transfer->reason, 'Reserve' ); |
4086 |
|
4087 |
t::lib::Mocks::mock_userenv( { branchcode => $library_2->branchcode } ); |
4088 |
AddIssue( $patron_1->unblessed, $item->barcode ); |
4089 |
$transfer = $transfer->get_from_storage; |
4090 |
isnt( $transfer->datearrived, undef ); |
4091 |
$hold = $hold->get_from_storage; |
4092 |
is( $hold->found, undef, 'Hold is waiting' ); |
4093 |
is( $hold->priority, 1, ); |
4094 |
}; |
4095 |
|
4039 |
$schema->storage->txn_rollback; |
4096 |
$schema->storage->txn_rollback; |
4040 |
C4::Context->clear_syspref_cache(); |
4097 |
C4::Context->clear_syspref_cache(); |
4041 |
$branches = Koha::Libraries->search(); |
4098 |
$branches = Koha::Libraries->search(); |
4042 |
- |
|
|