Bug 25375: Adjust tests and test itemlost, not notforloan

Previous commit correctly lists Zebra availability test, but was a
bad edit. This fixes the availability test to use itemlost

Additiionally, tests were written before limits were agreed. Adjusted
for the current settings

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 471facdf26)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 544b89cf90)
Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
This commit is contained in:
Nick Clemens 2022-09-13 13:06:03 +00:00 committed by Arthur Suzuki
parent 08612d98fc
commit b70eb7f8b0
2 changed files with 4 additions and 4 deletions

View File

@ -779,7 +779,7 @@ sub marc_records_to_documents {
my $avail_items = Koha::Items->search({
biblionumber => $biblionumber,
onloan => undef,
notforloan => 0,
itemlost => 0,
})->count;
$record_document->{available} = $avail_items ? \1 : \0;

View File

@ -962,7 +962,7 @@ subtest 'marc_records_to_documents should set the "available" field' => sub {
$item->notforloan(1)->store();
$docs = $see->marc_records_to_documents([$marc_record_1]);
is_deeply($docs->[0]->{available}, \0, 'a biblio with one item that is "notforloan" is not available');
is_deeply($docs->[0]->{available}, \1, 'a biblio with one item that is "notforloan" is available');
$item->set({ notforloan => 0, onloan => '2022-03-03' })->store();
$docs = $see->marc_records_to_documents([$marc_record_1]);
@ -970,7 +970,7 @@ subtest 'marc_records_to_documents should set the "available" field' => sub {
$item->set({ onloan => undef, withdrawn => 1 })->store();
$docs = $see->marc_records_to_documents([$marc_record_1]);
is_deeply($docs->[0]->{available}, \0, 'a biblio with one item that is withdrawn is not available');
is_deeply($docs->[0]->{available}, \1, 'a biblio with one item that is withdrawn is available');
$item->set({ withdrawn => 0, itemlost => 1 })->store();
$docs = $see->marc_records_to_documents([$marc_record_1]);
@ -978,7 +978,7 @@ subtest 'marc_records_to_documents should set the "available" field' => sub {
$item->set({ itemlost => 0, damaged => 1 })->store();
$docs = $see->marc_records_to_documents([$marc_record_1]);
is_deeply($docs->[0]->{available}, \0, 'a biblio with one item that is damaged is not available');
is_deeply($docs->[0]->{available}, \1, 'a biblio with one item that is damaged is available');
my $item2 = Koha::Item->new({
biblionumber => $biblionumber,