Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 4; |
22 |
use Test::More tests => 5; |
23 |
use Test::Exception; |
23 |
use Test::Exception; |
24 |
|
24 |
|
25 |
use Koha::CirculationRules; |
25 |
use Koha::CirculationRules; |
Lines 297-302
subtest 'get_effective_daysmode' => sub {
Link Here
|
297 |
$schema->storage->txn_rollback; |
297 |
$schema->storage->txn_rollback; |
298 |
}; |
298 |
}; |
299 |
|
299 |
|
|
|
300 |
subtest 'get_effective_expire_reserves_charge' => sub { |
301 |
plan tests => 4; |
302 |
|
303 |
$schema->storage->txn_begin; |
304 |
|
305 |
Koha::CirculationRules->search({ rule_name => 'expire_reserves_charge' })->delete; |
306 |
|
307 |
t::lib::Mocks::mock_preference( 'ExpireReservesMaxPickUpDelayCharge', 10 ); |
308 |
|
309 |
is( |
310 |
Koha::CirculationRules->get_effective_expire_reserves_charge( |
311 |
{ |
312 |
itemtype => undef, |
313 |
branchcode => undef, |
314 |
categorycode => undef, |
315 |
} |
316 |
), |
317 |
'10', |
318 |
'use the default pref value as the circ rule does not exist' |
319 |
); |
320 |
|
321 |
Koha::CirculationRules->set_rule( |
322 |
{ |
323 |
branchcode => '*', |
324 |
categorycode => '*', |
325 |
itemtype => '*', |
326 |
rule_name => 'expire_reserves_charge', |
327 |
rule_value => '20' |
328 |
} |
329 |
); |
330 |
|
331 |
is( |
332 |
Koha::CirculationRules->get_effective_expire_reserves_charge( |
333 |
{ |
334 |
categorycode => undef, |
335 |
itemtype => undef, |
336 |
branchcode => undef |
337 |
} |
338 |
), |
339 |
'20', |
340 |
"use the value from the circ rules" |
341 |
); |
342 |
|
343 |
t::lib::Mocks::mock_preference( 'ExpireReservesMaxPickUpDelayCharge', 30 ); |
344 |
|
345 |
Koha::CirculationRules->set_rule( |
346 |
{ |
347 |
branchcode => '*', |
348 |
categorycode => '*', |
349 |
itemtype => '*', |
350 |
rule_name => 'expire_reserves_charge', |
351 |
rule_value => undef |
352 |
} |
353 |
); |
354 |
|
355 |
is( |
356 |
Koha::CirculationRules->get_effective_expire_reserves_charge( |
357 |
{ |
358 |
categorycode => undef, |
359 |
itemtype => undef, |
360 |
branchcode => undef |
361 |
} |
362 |
), |
363 |
'30', |
364 |
"use the default pref value for as the circ rule has undefined value" |
365 |
); |
366 |
|
367 |
Koha::CirculationRules->set_rule( |
368 |
{ |
369 |
branchcode => '*', |
370 |
categorycode => '*', |
371 |
itemtype => '*', |
372 |
rule_name => 'expire_reserves_charge', |
373 |
rule_value => '0' |
374 |
} |
375 |
); |
376 |
|
377 |
is( |
378 |
Koha::CirculationRules->get_effective_expire_reserves_charge( |
379 |
{ |
380 |
categorycode => undef, |
381 |
itemtype => undef, |
382 |
branchcode => undef |
383 |
} |
384 |
), |
385 |
'0', |
386 |
"use the value from the circ rules for even though it's 0" |
387 |
); |
388 |
|
389 |
$schema->storage->txn_rollback; |
390 |
}; |
391 |
|
300 |
subtest 'get_lostreturn_policy() tests' => sub { |
392 |
subtest 'get_lostreturn_policy() tests' => sub { |
301 |
plan tests => 7; |
393 |
plan tests => 7; |
302 |
|
394 |
|
303 |
- |
|
|