Bug 33500: Add tests for RecordLocalUseOnReturn
To test:
1. Turn on RecordLocalUseOnReturn
2. prove -v /kohadevbox/koha/t/db_dependent/Circulation.t
3. Tests fail.
4. Apply patch
5. prove -v /kohadevbox/koha/t/db_dependent/Circulation.t
6. Tests pass.
Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 2238d9f096
)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
d89d452a9d
commit
b07fa2af06
1 changed files with 21 additions and 1 deletions
|
@ -18,7 +18,7 @@
|
|||
use Modern::Perl;
|
||||
use utf8;
|
||||
|
||||
use Test::More tests => 66;
|
||||
use Test::More tests => 67;
|
||||
use Test::Exception;
|
||||
use Test::MockModule;
|
||||
use Test::Deep qw( cmp_deeply );
|
||||
|
@ -5803,6 +5803,7 @@ subtest 'Tests for BlockReturnOfWithdrawnItems' => sub {
|
|||
plan tests => 1;
|
||||
|
||||
t::lib::Mocks::mock_preference('BlockReturnOfWithdrawnItems', 1);
|
||||
t::lib::Mocks::mock_preference('RecordLocalUseOnReturn', 0);
|
||||
my $item = $builder->build_sample_item();
|
||||
$item->withdrawn(1)->itemlost(1)->store;
|
||||
my @return = AddReturn( $item->barcode, $item->homebranch, 0, undef );
|
||||
|
@ -5836,6 +5837,25 @@ subtest 'Tests for transfer not in transit' => sub {
|
|||
|
||||
};
|
||||
|
||||
subtest 'Tests for RecordLocalUseOnReturn' => sub {
|
||||
|
||||
plan tests => 2;
|
||||
|
||||
t::lib::Mocks::mock_preference('RecordLocalUseOnReturn', 0);
|
||||
my $item = $builder->build_sample_item();
|
||||
$item->withdrawn(1)->itemlost(1)->store;
|
||||
my @return = AddReturn( $item->barcode, $item->homebranch, 0, undef );
|
||||
is_deeply(
|
||||
\@return,
|
||||
[ 0, { NotIssued => $item->barcode, withdrawn => 1 }, undef, {} ], "RecordLocalUSeOnReturn is off, no local use recorded");
|
||||
|
||||
t::lib::Mocks::mock_preference('RecordLocalUseOnReturn', 1);
|
||||
my @return2 = AddReturn( $item->barcode, $item->homebranch, 0, undef );
|
||||
is_deeply(
|
||||
\@return2,
|
||||
[ 0, { NotIssued => $item->barcode, withdrawn => 1, LocalUse => 1 }, undef, {} ], "Local use is recorded");
|
||||
};
|
||||
|
||||
$schema->storage->txn_rollback;
|
||||
C4::Context->clear_syspref_cache();
|
||||
$branches = Koha::Libraries->search();
|
||||
|
|
Loading…
Reference in a new issue