Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 63; |
20 |
use Test::More tests => 64; |
21 |
use Test::MockModule; |
21 |
use Test::MockModule; |
22 |
use Test::Warn; |
22 |
use Test::Warn; |
23 |
|
23 |
|
Lines 1075-1080
subtest 'RevertWaitingStatus' => sub {
Link Here
|
1075 |
); |
1075 |
); |
1076 |
}; |
1076 |
}; |
1077 |
|
1077 |
|
|
|
1078 |
subtest 'CheckReserves additional test' => sub { |
1079 |
|
1080 |
plan tests => 3; |
1081 |
|
1082 |
my $biblio = $builder->build_sample_biblio(); |
1083 |
my $itype = $builder->build_object({ class => "Koha::ItemTypes", value => { notforloan => 0 } }); |
1084 |
my $item_1 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber,notforloan => 0, itype => $itype->itemtype }); |
1085 |
my $reserve1 = $builder->build_object({ |
1086 |
class => "Koha::Holds", |
1087 |
value => { |
1088 |
found => undef, |
1089 |
priority => 1, |
1090 |
itemnumber => undef, |
1091 |
biblionumber => $biblio->biblionumber, |
1092 |
waitingdate => undef, |
1093 |
cancellationdate => undef, |
1094 |
item_level_hold => 0, |
1095 |
lowestPriority => 0, |
1096 |
expirationdate => undef, |
1097 |
suspend_until => undef, |
1098 |
suspend => 0, |
1099 |
itemtype => undef, |
1100 |
} |
1101 |
}); |
1102 |
my $reserve2 = $builder->build_object({ |
1103 |
class => "Koha::Holds", |
1104 |
value => { |
1105 |
found => undef, |
1106 |
priority => 2, |
1107 |
biblionumber => $biblio->biblionumber, |
1108 |
borrowernumber => $reserve1->borrowernumber, |
1109 |
itemnumber => undef, |
1110 |
waitingdate => undef, |
1111 |
cancellationdate => undef, |
1112 |
item_level_hold => 0, |
1113 |
lowestPriority => 0, |
1114 |
expirationdate => undef, |
1115 |
suspend_until => undef, |
1116 |
suspend => 0, |
1117 |
itemtype => undef, |
1118 |
} |
1119 |
}); |
1120 |
|
1121 |
my $tmp_holdsqueue = $builder->build({source=>'TmpHoldsqueue',value=>{ |
1122 |
borrowernumber => $reserve1->borrowernumber, |
1123 |
biblionumber => $reserve1->biblionumber, |
1124 |
} |
1125 |
}); |
1126 |
my $fill_target = $builder->build({source=>'HoldFillTarget',value=>{ |
1127 |
borrowernumber => $reserve1->borrowernumber, |
1128 |
biblionumber => $reserve1->biblionumber, |
1129 |
itemnumber => $item_1->itemnumber, |
1130 |
item_level_request => 0, |
1131 |
} |
1132 |
}); |
1133 |
|
1134 |
ModReserveAffect( $item_1->itemnumber, $reserve1->borrowernumber, 1, $reserve1->reserve_id ); |
1135 |
my ($status, $matched_reserve, $possible_reserves) = CheckReserves($item_1->itemnumber); |
1136 |
|
1137 |
is( $status, 'Reserved', "We found a reserve" ); |
1138 |
is( $matched_reserve->{reserve_id}, $reserve1->reserve_id, "We got the Transit reserve"); |
1139 |
is( scalar @$possible_reserves, 1, 'We only get the one matched'); |
1140 |
|
1141 |
}; |
1142 |
|
1078 |
sub count_hold_print_messages { |
1143 |
sub count_hold_print_messages { |
1079 |
my $message_count = $dbh->selectall_arrayref(q{ |
1144 |
my $message_count = $dbh->selectall_arrayref(q{ |
1080 |
SELECT COUNT(*) |
1145 |
SELECT COUNT(*) |
1081 |
- |
|
|