|
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 => 66; |
21 |
use Test::More tests => 67; |
| 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 5803-5808
subtest 'Tests for BlockReturnOfWithdrawnItems' => sub {
Link Here
|
| 5803 |
plan tests => 1; |
5803 |
plan tests => 1; |
| 5804 |
|
5804 |
|
| 5805 |
t::lib::Mocks::mock_preference('BlockReturnOfWithdrawnItems', 1); |
5805 |
t::lib::Mocks::mock_preference('BlockReturnOfWithdrawnItems', 1); |
|
|
5806 |
t::lib::Mocks::mock_preference('RecordLocalUseOnReturn', 0); |
| 5806 |
my $item = $builder->build_sample_item(); |
5807 |
my $item = $builder->build_sample_item(); |
| 5807 |
$item->withdrawn(1)->itemlost(1)->store; |
5808 |
$item->withdrawn(1)->itemlost(1)->store; |
| 5808 |
my @return = AddReturn( $item->barcode, $item->homebranch, 0, undef ); |
5809 |
my @return = AddReturn( $item->barcode, $item->homebranch, 0, undef ); |
|
Lines 5836-5841
subtest 'Tests for transfer not in transit' => sub {
Link Here
|
| 5836 |
|
5837 |
|
| 5837 |
}; |
5838 |
}; |
| 5838 |
|
5839 |
|
|
|
5840 |
subtest 'Tests for RecordLocalUseOnReturn' => sub { |
| 5841 |
|
| 5842 |
plan tests => 2; |
| 5843 |
|
| 5844 |
t::lib::Mocks::mock_preference('RecordLocalUseOnReturn', 0); |
| 5845 |
my $item = $builder->build_sample_item(); |
| 5846 |
$item->withdrawn(1)->itemlost(1)->store; |
| 5847 |
my @return = AddReturn( $item->barcode, $item->homebranch, 0, undef ); |
| 5848 |
is_deeply( |
| 5849 |
\@return, |
| 5850 |
[ 0, { NotIssued => $item->barcode, withdrawn => 1 }, undef, {} ], "RecordLocalUSeOnReturn is off, no local use recorded"); |
| 5851 |
|
| 5852 |
t::lib::Mocks::mock_preference('RecordLocalUseOnReturn', 1); |
| 5853 |
my @return2 = AddReturn( $item->barcode, $item->homebranch, 0, undef ); |
| 5854 |
is_deeply( |
| 5855 |
\@return2, |
| 5856 |
[ 0, { NotIssued => $item->barcode, withdrawn => 1, LocalUse => 1 }, undef, {} ], "Local use is recorded"); |
| 5857 |
}; |
| 5858 |
|
| 5839 |
$schema->storage->txn_rollback; |
5859 |
$schema->storage->txn_rollback; |
| 5840 |
C4::Context->clear_syspref_cache(); |
5860 |
C4::Context->clear_syspref_cache(); |
| 5841 |
$branches = Koha::Libraries->search(); |
5861 |
$branches = Koha::Libraries->search(); |
| 5842 |
- |
|
|