Bug 28210: Unit test

Add a unit test to check that skip_record_index is adhered to when
passed to LostItem with the force_mark_returned option enabled.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Martin Renvoize 2021-04-23 16:52:59 +01:00 committed by Jonathan Druart
parent 7b15138278
commit bc0cf683ee
1 changed files with 7 additions and 1 deletions

View File

@ -61,7 +61,7 @@ subtest 'Test indexer object creation' => sub {
};
subtest 'Test indexer calls' => sub {
plan tests => 36;
plan tests => 40;
my @engines = ('Zebra');
eval { Koha::SearchEngine::Elasticsearch->get_elasticsearch_params; };
@ -158,6 +158,12 @@ subtest 'Test indexer calls' => sub {
warnings_are{
AddReturn($item->barcode, $item->homebranch, 0, undef);
} [$engine,'C4::Circulation'], "index_records is called once for $engine when calling AddReturn if item not issued";
warnings_are{
LostItem( $item->itemnumber, "tests", 1);
} [$engine,"Koha::Item"], "index_records is called for $engine when calling LostItem with 'force_mark_returned'";
warnings_are{
LostItem( $item->itemnumber, "tests", 1, { skip_record_index => 1 });
} undef, "index_records is not called for $engine when calling LostItem with 'force_mark_returned' if skip_record_index";
$item->datelastseen('2020-02-02');
$item->store({skip_record_index=>1});