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