|
Lines 379-385
subtest 'get_effective_daysmode' => sub {
Link Here
|
| 379 |
}; |
379 |
}; |
| 380 |
|
380 |
|
| 381 |
subtest 'get_lostreturn_policy() tests' => sub { |
381 |
subtest 'get_lostreturn_policy() tests' => sub { |
| 382 |
plan tests => 6; |
382 |
plan tests => 7; |
| 383 |
|
383 |
|
| 384 |
$schema->storage->txn_begin; |
384 |
$schema->storage->txn_begin; |
| 385 |
|
385 |
|
|
Lines 451-458
subtest 'get_lostreturn_policy() tests' => sub {
Link Here
|
| 451 |
|
451 |
|
| 452 |
my $item = $builder->build_sample_item( |
452 |
my $item = $builder->build_sample_item( |
| 453 |
{ |
453 |
{ |
| 454 |
homebranch => $specific_rule_true->{branchcode}, |
454 |
homebranch => $specific_rule_false->{branchcode}, |
| 455 |
holdingbranch => $specific_rule_false->{branchcode} |
455 |
holdingbranch => $specific_rule_true->{branchcode} |
| 456 |
} |
456 |
} |
| 457 |
); |
457 |
); |
| 458 |
my $params = { |
458 |
my $params = { |
|
Lines 467-477
subtest 'get_lostreturn_policy() tests' => sub {
Link Here
|
| 467 |
|
467 |
|
| 468 |
t::lib::Mocks::mock_preference( 'RefundLostOnReturnControl', 'ItemHomeBranch' ); |
468 |
t::lib::Mocks::mock_preference( 'RefundLostOnReturnControl', 'ItemHomeBranch' ); |
| 469 |
is( Koha::CirculationRules->get_lostreturn_policy( $params ), |
469 |
is( Koha::CirculationRules->get_lostreturn_policy( $params ), |
| 470 |
1,'Specific rule for home branch is applied (true)'); |
470 |
0,'Specific rule for home branch is applied (false)'); |
| 471 |
|
471 |
|
| 472 |
t::lib::Mocks::mock_preference( 'RefundLostOnReturnControl', 'ItemHoldingBranch' ); |
472 |
t::lib::Mocks::mock_preference( 'RefundLostOnReturnControl', 'ItemHoldingBranch' ); |
| 473 |
is( Koha::CirculationRules->get_lostreturn_policy( $params ), |
473 |
is( Koha::CirculationRules->get_lostreturn_policy( $params ), |
| 474 |
0,'Specific rule for holoding branch is applied (false)'); |
474 |
1,'Specific rule for holding branch is applied (true)'); |
| 475 |
|
475 |
|
| 476 |
# Default rule check |
476 |
# Default rule check |
| 477 |
t::lib::Mocks::mock_preference( 'RefundLostOnReturnControl', 'CheckinLibrary' ); |
477 |
t::lib::Mocks::mock_preference( 'RefundLostOnReturnControl', 'CheckinLibrary' ); |
|
Lines 499-503
subtest 'get_lostreturn_policy() tests' => sub {
Link Here
|
| 499 |
is( Koha::CirculationRules->get_lostreturn_policy( $params ), |
499 |
is( Koha::CirculationRules->get_lostreturn_policy( $params ), |
| 500 |
1,'No rule for branch, no default rule, fallback default (true)'); |
500 |
1,'No rule for branch, no default rule, fallback default (true)'); |
| 501 |
|
501 |
|
|
|
502 |
# Fallback to ItemHoldBranch if CheckinLibrary is undefined |
| 503 |
$params->{return_branch} = undef; |
| 504 |
is( Koha::CirculationRules->get_lostreturn_policy( $params ), |
| 505 |
0,'return_branch undefined, fallback to ItemHomeBranch rule (false)'); |
| 506 |
|
| 502 |
$schema->storage->txn_rollback; |
507 |
$schema->storage->txn_rollback; |
| 503 |
}; |
508 |
}; |
| 504 |
- |
|
|