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:
parent
1a633d68da
commit
85fa7b04fb
1 changed files with 13 additions and 1 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue