|
Lines 5-10
Link Here
|
| 5 |
|
5 |
|
| 6 |
use Modern::Perl; |
6 |
use Modern::Perl; |
| 7 |
use Test::More tests => 18; |
7 |
use Test::More tests => 18; |
|
|
8 |
use Test::Warn; |
| 8 |
|
9 |
|
| 9 |
use Koha::Database; |
10 |
use Koha::Database; |
| 10 |
use t::lib::TestBuilder; |
11 |
use t::lib::TestBuilder; |
|
Lines 975-987
subtest checkin_withdrawn => sub {
Link Here
|
| 975 |
}; |
976 |
}; |
| 976 |
|
977 |
|
| 977 |
subtest _get_sort_bin => sub { |
978 |
subtest _get_sort_bin => sub { |
| 978 |
plan tests => 5; |
979 |
plan tests => 6; |
| 979 |
|
980 |
|
| 980 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
981 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
| 981 |
my $branch = $library->branchcode; |
982 |
my $branch = $library->branchcode; |
| 982 |
my $library2 = $builder->build_object( { class => 'Koha::Libraries' } ); |
983 |
my $library2 = $builder->build_object( { class => 'Koha::Libraries' } ); |
| 983 |
my $branch2 = $library2->branchcode; |
984 |
my $branch2 = $library2->branchcode; |
| 984 |
|
985 |
|
|
|
986 |
# Rules starts with malformed line, empty line and a comment to prove they are skipped |
| 985 |
my $rules = <<"RULES"; |
987 |
my $rules = <<"RULES"; |
| 986 |
$branch:homebranch:ne:\$holdingbranch:X\r |
988 |
$branch:homebranch:ne:\$holdingbranch:X\r |
| 987 |
$branch:effective_itemtype:eq:CD:0\r |
989 |
$branch:effective_itemtype:eq:CD:0\r |
|
Lines 992-998
$branch2:homebranch:ne:\$holdingbranch:X\r
Link Here
|
| 992 |
$branch2:effective_itemtype:eq:CD:4\r |
994 |
$branch2:effective_itemtype:eq:CD:4\r |
| 993 |
$branch2:itemcallnumber:>:600:5\r |
995 |
$branch2:itemcallnumber:>:600:5\r |
| 994 |
$branch2:effective_itemtype:eq:BOOK:ccode:eq:TEEN:6\r |
996 |
$branch2:effective_itemtype:eq:BOOK:ccode:eq:TEEN:6\r |
|
|
997 |
# Comment line to skip\r |
| 998 |
\r |
| 999 |
$branch:homebranch:Z\r |
| 995 |
RULES |
1000 |
RULES |
|
|
1001 |
|
| 996 |
t::lib::Mocks::mock_preference( 'SIP2SortBinMapping', $rules ); |
1002 |
t::lib::Mocks::mock_preference( 'SIP2SortBinMapping', $rules ); |
| 997 |
|
1003 |
|
| 998 |
my $item_cd = $builder->build_sample_item( |
1004 |
my $item_cd = $builder->build_sample_item( |
|
Lines 1018-1023
RULES
Link Here
|
| 1018 |
} |
1024 |
} |
| 1019 |
); |
1025 |
); |
| 1020 |
|
1026 |
|
|
|
1027 |
my $item_dvd = $builder->build_sample_item( |
| 1028 |
{ |
| 1029 |
library => $library2->branchcode, |
| 1030 |
itype => 'DVD' |
| 1031 |
} |
| 1032 |
); |
| 1033 |
|
| 1021 |
my $bin; |
1034 |
my $bin; |
| 1022 |
|
1035 |
|
| 1023 |
# Set holdingbranch as though item returned to library other than homebranch (As AddReturn would) |
1036 |
# Set holdingbranch as though item returned to library other than homebranch (As AddReturn would) |
|
Lines 1037-1042
RULES
Link Here
|
| 1037 |
|
1050 |
|
| 1038 |
$bin = C4::SIP::ILS::Transaction::Checkin::_get_sort_bin( $item_book2, $library2->branchcode ); |
1051 |
$bin = C4::SIP::ILS::Transaction::Checkin::_get_sort_bin( $item_book2, $library2->branchcode ); |
| 1039 |
is( $bin, '6', "Rules with multiple field matches" ); |
1052 |
is( $bin, '6', "Rules with multiple field matches" ); |
|
|
1053 |
|
| 1054 |
warnings_are { $bin = C4::SIP::ILS::Transaction::Checkin::_get_sort_bin( $item_dvd, $library2->branchcode ); } |
| 1055 |
["Malformed preference line found: '$branch:homebranch:Z'"], |
| 1056 |
"Comments and blank lines are skipped, Malformed lines are warned and skipped"; |
| 1040 |
}; |
1057 |
}; |
| 1041 |
|
1058 |
|
| 1042 |
subtest item_circulation_status => sub { |
1059 |
subtest item_circulation_status => sub { |
| 1043 |
- |
|
|