|
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 => 54; |
21 |
use Test::More tests => 55; |
| 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 4879-4884
subtest "Item's onloan value should be set if checked out item is checked out to
Link Here
|
| 4879 |
ok( $item->get_from_storage->onloan, "Item's onloan column is set after second checkout" ); |
4879 |
ok( $item->get_from_storage->onloan, "Item's onloan column is set after second checkout" ); |
| 4880 |
}; |
4880 |
}; |
| 4881 |
|
4881 |
|
|
|
4882 |
subtest "updateWrongTransfer tests" => sub { |
| 4883 |
plan tests => 5; |
| 4884 |
|
| 4885 |
my $library1 = $builder->build_object( { class => 'Koha::Libraries' } ); |
| 4886 |
my $library2 = $builder->build_object( { class => 'Koha::Libraries' } ); |
| 4887 |
my $library3 = $builder->build_object( { class => 'Koha::Libraries' } ); |
| 4888 |
my $item = $builder->build_sample_item( |
| 4889 |
{ |
| 4890 |
homebranch => $library1->branchcode, |
| 4891 |
holdingbranch => $library2->branchcode, |
| 4892 |
datelastseen => undef |
| 4893 |
} |
| 4894 |
); |
| 4895 |
|
| 4896 |
my $transfer = $builder->build_object( |
| 4897 |
{ |
| 4898 |
class => 'Koha::Item::Transfers', |
| 4899 |
value => { |
| 4900 |
itemnumber => $item->itemnumber, |
| 4901 |
frombranch => $library2->branchcode, |
| 4902 |
tobranch => $library1->branchcode, |
| 4903 |
daterequested => dt_from_string, |
| 4904 |
datesent => dt_from_string, |
| 4905 |
datecancelled => undef, |
| 4906 |
datearrived => undef, |
| 4907 |
reason => 'Manual' |
| 4908 |
} |
| 4909 |
} |
| 4910 |
); |
| 4911 |
is( ref($transfer), 'Koha::Item::Transfer', 'Mock transfer added' ); |
| 4912 |
|
| 4913 |
my $new_transfer = C4::Circulation::updateWrongTransfer($item->itemnumber, $library1->branchcode); |
| 4914 |
is(ref($new_transfer), 'Koha::Item::Transfer', "updateWrongTransfer returns a 'Koha::Item::Transfer' object"); |
| 4915 |
ok( !$new_transfer->in_transit, "New transfer is NOT created as in transit (or cancelled)"); |
| 4916 |
|
| 4917 |
my $original_transfer = $transfer->get_from_storage; |
| 4918 |
ok( defined($original_transfer->datecancelled), "Original transfer was cancelled"); |
| 4919 |
is( $original_transfer->cancellation_reason, 'WrongTransfer', "Original transfer cancellation reason is 'WrongTransfer'"); |
| 4920 |
}; |
| 4921 |
|
| 4882 |
$schema->storage->txn_rollback; |
4922 |
$schema->storage->txn_rollback; |
| 4883 |
C4::Context->clear_syspref_cache(); |
4923 |
C4::Context->clear_syspref_cache(); |
| 4884 |
$branches = Koha::Libraries->search(); |
4924 |
$branches = Koha::Libraries->search(); |
| 4885 |
- |
|
|