From 85fa7b04fb30eac363b6f8caea80abb7e632710d Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 7 Sep 2023 17:23:42 +0100 Subject: [PATCH] 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 Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- t/db_dependent/SIP/Transaction.t | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/SIP/Transaction.t b/t/db_dependent/SIP/Transaction.t index 7703330314..d595a0ef69 100755 --- a/t/db_dependent/SIP/Transaction.t +++ b/t/db_dependent/SIP/Transaction.t @@ -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 { -- 2.39.2