Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 56; |
20 |
use Test::More tests => 60; |
21 |
|
21 |
|
22 |
use MARC::Record; |
22 |
use MARC::Record; |
23 |
use DateTime::Duration; |
23 |
use DateTime::Duration; |
Lines 80-85
else {
Link Here
|
80 |
my ($bibnum, $bibitemnum); |
80 |
my ($bibnum, $bibitemnum); |
81 |
($bibnum, $title, $bibitemnum) = AddBiblio($bib, ''); |
81 |
($bibnum, $title, $bibitemnum) = AddBiblio($bib, ''); |
82 |
|
82 |
|
|
|
83 |
my $miniaturist = MARC::Record->new(); |
84 |
my $title = 'The Miniaturist'; |
85 |
if( C4::Context->preference('marcflavour') eq 'UNIMARC' ) { |
86 |
$miniaturist->append_fields( |
87 |
MARC::Field->new('600', '', '1', a => 'Burton, Jessie'), |
88 |
MARC::Field->new('200', '', '', a => $title), |
89 |
); |
90 |
} |
91 |
else { |
92 |
$miniaturist->append_fields( |
93 |
MARC::Field->new('100', '', '', a => 'Burton, Jessie'), |
94 |
MARC::Field->new('245', '', '', a => $title), |
95 |
); |
96 |
} |
97 |
my ($miniaturist_id, $title, $bibitemnum) = AddBiblio($miniaturist, ''); |
98 |
|
99 |
my $broken = MARC::Record->new(); |
100 |
my $title = 'The broken'; |
101 |
if( C4::Context->preference('marcflavour') eq 'UNIMARC' ) { |
102 |
$broken->append_fields( |
103 |
MARC::Field->new('600', '', '1', a => 'Cohen, Tamar'), |
104 |
MARC::Field->new('200', '', '', a => $title), |
105 |
); |
106 |
} |
107 |
else { |
108 |
$broken->append_fields( |
109 |
MARC::Field->new('100', '', '', a => 'Cohen, Tamar'), |
110 |
MARC::Field->new('245', '', '', a => $title), |
111 |
); |
112 |
} |
113 |
my ($broken_id, $title, $bibitemnum) = AddBiblio($miniaturist, ''); |
114 |
|
83 |
# Create a helper item instance for testing |
115 |
# Create a helper item instance for testing |
84 |
my ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => 'CPL', holdingbranch => 'CPL' } , $bibnum); |
116 |
my ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => 'CPL', holdingbranch => 'CPL' } , $bibnum); |
85 |
|
117 |
|
Lines 127-132
is($status, "Reserved", "CheckReserves Test 2");
Link Here
|
127 |
($status, $reserve, $all_reserves) = CheckReserves(undef, $barcode); |
159 |
($status, $reserve, $all_reserves) = CheckReserves(undef, $barcode); |
128 |
is($status, "Reserved", "CheckReserves Test 3"); |
160 |
is($status, "Reserved", "CheckReserves Test 3"); |
129 |
|
161 |
|
|
|
162 |
ok(AlreadyReserved($biblionumber, $borrowernumber), 'First borrower already reserved first biblio'); |
163 |
|
164 |
t::lib::Mocks::mock_preference('maxreserves', 3); |
165 |
|
166 |
ok(!ReachedMaxReserves($borrowernumber), 'First borrower doesn\'t reached max reserves'); |
167 |
|
168 |
AddReserve($branch, $borrowernumber, $miniaturist_id, |
169 |
$constraint, $bibitems, $priority, $resdate, $expdate, $notes, |
170 |
$title, $checkitem, $found); |
171 |
|
172 |
AddReserve($branch, $borrowernumber, $broken_id, |
173 |
$constraint, $bibitems, $priority, $resdate, $expdate, $notes, |
174 |
$title, $checkitem, $found); |
175 |
|
176 |
ok(ReachedMaxReserves($borrowernumber), 'First borrower reached max reserves'); |
177 |
|
178 |
t::lib::Mocks::mock_preference('maxreserves', 15); |
179 |
|
130 |
my $ReservesControlBranch = C4::Context->preference('ReservesControlBranch'); |
180 |
my $ReservesControlBranch = C4::Context->preference('ReservesControlBranch'); |
131 |
C4::Context->set_preference( 'ReservesControlBranch', 'ItemHomeLibrary' ); |
181 |
C4::Context->set_preference( 'ReservesControlBranch', 'ItemHomeLibrary' ); |
132 |
ok( |
182 |
ok( |
Lines 292-297
is($reserve, undef, "GetReserve returns undef after deletion");
Link Here
|
292 |
$reserve = CancelReserve({reserve_id => $reserve_id}); |
342 |
$reserve = CancelReserve({reserve_id => $reserve_id}); |
293 |
is($reserve, undef, "CancelReserve return undef if reserve does not exist"); |
343 |
is($reserve, undef, "CancelReserve return undef if reserve does not exist"); |
294 |
|
344 |
|
|
|
345 |
ok(!AlreadyReserved($bibnum2, $borrowernumber), 'First borrower does not already reserved second biblio'); |
346 |
|
295 |
|
347 |
|
296 |
# Tests for bug 9761 (ConfirmFutureHolds): new CheckReserves lookahead parameter, and corresponding change in AddReturn |
348 |
# Tests for bug 9761 (ConfirmFutureHolds): new CheckReserves lookahead parameter, and corresponding change in AddReturn |
297 |
# Note that CheckReserve uses its lookahead parameter and does not check ConfirmFutureHolds pref (it should be passed if needed like AddReturn does) |
349 |
# Note that CheckReserve uses its lookahead parameter and does not check ConfirmFutureHolds pref (it should be passed if needed like AddReturn does) |
298 |
- |
|
|