Lines 117-122
$cache->clear_from_cache('single_holidays');
Link Here
|
117 |
$dbh->do('DELETE FROM issues'); |
117 |
$dbh->do('DELETE FROM issues'); |
118 |
$dbh->do('DELETE FROM borrowers'); |
118 |
$dbh->do('DELETE FROM borrowers'); |
119 |
|
119 |
|
|
|
120 |
# Disable recording of issuer until we're ready for it |
121 |
t::lib::Mocks::mock_preference('RecordIssuer', 0); |
122 |
|
123 |
my $module = new Test::MockModule('C4::Context'); |
124 |
|
120 |
my $library = $builder->build({ |
125 |
my $library = $builder->build({ |
121 |
source => 'Branch', |
126 |
source => 'Branch', |
122 |
}); |
127 |
}); |
Lines 3368-3374
subtest 'Incremented fee tests' => sub {
Link Here
|
3368 |
my $library = |
3373 |
my $library = |
3369 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
3374 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
3370 |
|
3375 |
|
3371 |
my $module = new Test::MockModule('C4::Context'); |
|
|
3372 |
$module->mock( 'userenv', sub { { branch => $library->id } } ); |
3376 |
$module->mock( 'userenv', sub { { branch => $library->id } } ); |
3373 |
|
3377 |
|
3374 |
my $patron = $builder->build_object( |
3378 |
my $patron = $builder->build_object( |
Lines 3647-3652
subtest "Test Backdating of Returns" => sub {
Link Here
|
3647 |
is( $accountline->amount+0, 0, 'Fee amount was reduced to 0' ); |
3651 |
is( $accountline->amount+0, 0, 'Fee amount was reduced to 0' ); |
3648 |
}; |
3652 |
}; |
3649 |
|
3653 |
|
|
|
3654 |
subtest 'AddIssue records issuer if appropriate' => sub { |
3655 |
plan tests => 2; |
3656 |
|
3657 |
$module->mock( 'userenv', sub { { branch => $library->{id} } } ); |
3658 |
|
3659 |
my $library = |
3660 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
3661 |
my $patron = $builder->build_object( |
3662 |
{ |
3663 |
class => 'Koha::Patrons', |
3664 |
value => { categorycode => $patron_category->{categorycode} } |
3665 |
} |
3666 |
)->store; |
3667 |
my $issuer = $builder->build_object( |
3668 |
{ |
3669 |
class => 'Koha::Patrons', |
3670 |
value => { categorycode => $patron_category->{categorycode} } |
3671 |
} |
3672 |
)->store; |
3673 |
my $item = $builder->build_sample_item( |
3674 |
{ |
3675 |
library => $library->{branchcode} |
3676 |
} |
3677 |
); |
3678 |
|
3679 |
$module->mock( 'userenv', sub { { branch => $library->id, number => $issuer->{borrowernumber} } } ); |
3680 |
|
3681 |
my $dt_from = dt_from_string(); |
3682 |
my $dt_to = dt_from_string()->add( days => 7 ); |
3683 |
|
3684 |
my $issue = |
3685 |
AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); |
3686 |
|
3687 |
is( $issue->issuer, undef, "Issuer not recorded when RecordIssuer turned off" ); |
3688 |
|
3689 |
t::lib::Mocks::mock_preference('RecordIssuer', 1); |
3690 |
|
3691 |
my $issue2 = |
3692 |
AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); |
3693 |
|
3694 |
is( $issue->issuer, $issuer->{borrowernumber}, "Issuer recorded when RecordIssuer turned on" ); |
3695 |
}; |
3696 |
|
3650 |
$schema->storage->txn_rollback; |
3697 |
$schema->storage->txn_rollback; |
3651 |
C4::Context->clear_syspref_cache(); |
3698 |
C4::Context->clear_syspref_cache(); |
3652 |
$cache->clear_from_cache('single_holidays'); |
3699 |
$cache->clear_from_cache('single_holidays'); |