Bug 34737: Unit tests

This patch adds unit test to prove the multi-field match functionality
added in this patchset.

Signed-off-by: Toni Ford <Toni.Ford@newcastle.gov.uk>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Martin Renvoize 2023-09-07 17:23:42 +01:00 committed by Tomas Cohen Arazi
parent 1a633d68da
commit 85fa7b04fb
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -912,7 +912,7 @@ subtest checkin_withdrawn => sub {
};
subtest _get_sort_bin => sub {
plan tests => 4;
plan tests => 5;
my $library = $builder->build_object( { class => 'Koha::Libraries' } );
my $branch = $library->branchcode;
@ -928,6 +928,7 @@ $branch:itemcallnumber:<:600:3\r
$branch2:homebranch:ne:\$holdingbranch:X\r
$branch2:effective_itemtype:eq:CD:4\r
$branch2:itemcallnumber:>:600:5\r
$branch2:effective_itemtype:eq:BOOK:ccode:eq:TEEN:6\r
RULES
t::lib::Mocks::mock_preference('SIP2SortBinMapping', $rules);
@ -946,6 +947,14 @@ RULES
}
);
my $item_book2 = $builder->build_sample_item(
{
library => $library2->branchcode,
itype => 'BOOK',
ccode => 'TEEN'
}
);
my $bin;
# Set holdingbranch as though item returned to library other than homebranch (As AddReturn would)
@ -962,6 +971,9 @@ RULES
$item_book->itemcallnumber('350.20')->store();
$bin = C4::SIP::ILS::Transaction::Checkin::_get_sort_bin( $item_book, $library->branchcode );
is($bin, '2', "Rules applied in order (< comparator)");
$bin = C4::SIP::ILS::Transaction::Checkin::_get_sort_bin( $item_book2, $library2->branchcode );
is($bin, '6', "Rules with multiple field matches");
};
subtest item_circulation_status => sub {