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