Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 4; |
20 |
use Test::More tests => 5; |
21 |
use Test::MockModule; |
21 |
use Test::MockModule; |
22 |
use Test::Warn; |
22 |
use Test::Warn; |
23 |
|
23 |
|
Lines 332-334
subtest 'Handle ids duplication' => sub {
Link Here
|
332 |
is( Koha::Checkouts->find( $issue_id )->issue_id, $issue_id, 'The issues entry should not have been removed' ); |
332 |
is( Koha::Checkouts->find( $issue_id )->issue_id, $issue_id, 'The issues entry should not have been removed' ); |
333 |
}; |
333 |
}; |
334 |
|
334 |
|
335 |
- |
335 |
subtest 'BlockReturnOfLostItems' => sub { |
|
|
336 |
plan tests => 3; |
337 |
my $biblio = $builder->build_object( { class => 'Koha::Biblios' } ); |
338 |
my $item = $builder->build_object( |
339 |
{ |
340 |
class => 'Koha::Items', |
341 |
value => { |
342 |
biblionumber => $biblio->biblionumber, |
343 |
notforloan => 0, |
344 |
itemlost => 0, |
345 |
withdrawn => 0, |
346 |
} |
347 |
} |
348 |
); |
349 |
my $patron = $builder->build_object({class => 'Koha::Patrons'}); |
350 |
my $checkout = AddIssue( $patron->unblessed, $item->barcode ); |
351 |
|
352 |
# Mark the item as lost |
353 |
ModItem({itemlost => 1}, $biblio->biblionumber, $item->itemnumber); |
354 |
|
355 |
t::lib::Mocks::mock_preference('BlockReturnOfLostItems', 1); |
356 |
my ( $doreturn, $messages, $issue ) = AddReturn($item->barcode); |
357 |
is( $doreturn, 0, "With BlockReturnOfLostItems, a checkin of a lost item should be blocked"); |
358 |
is( $messages->{WasLost}, 1, "... and the WasLost flag should be set"); |
359 |
|
360 |
t::lib::Mocks::mock_preference('BlockReturnOfLostItems', 0); |
361 |
( $doreturn, $messages, $issue ) = AddReturn($item->barcode); |
362 |
is( $doreturn, 1, "Without BlockReturnOfLostItems, a checkin of a lost item should not be blocked"); |
363 |
}; |