Lines 18-24
Link Here
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
use utf8; |
19 |
use utf8; |
20 |
|
20 |
|
21 |
use Test::More tests => 50; |
21 |
use Test::More tests => 51; |
22 |
use Test::Exception; |
22 |
use Test::Exception; |
23 |
use Test::MockModule; |
23 |
use Test::MockModule; |
24 |
use Test::Deep qw( cmp_deeply ); |
24 |
use Test::Deep qw( cmp_deeply ); |
Lines 122-127
for my $branch ( $branches->next ) {
Link Here
|
122 |
$dbh->do('DELETE FROM issues'); |
122 |
$dbh->do('DELETE FROM issues'); |
123 |
$dbh->do('DELETE FROM borrowers'); |
123 |
$dbh->do('DELETE FROM borrowers'); |
124 |
|
124 |
|
|
|
125 |
# Disable recording of issuer until we're ready for it |
126 |
t::lib::Mocks::mock_preference('RecordIssuer', 0); |
127 |
|
128 |
my $module = new Test::MockModule('C4::Context'); |
129 |
|
125 |
my $library = $builder->build({ |
130 |
my $library = $builder->build({ |
126 |
source => 'Branch', |
131 |
source => 'Branch', |
127 |
}); |
132 |
}); |
Lines 3797-3803
subtest 'Incremented fee tests' => sub {
Link Here
|
3797 |
my $library = |
3802 |
my $library = |
3798 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
3803 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
3799 |
|
3804 |
|
3800 |
my $module = Test::MockModule->new('C4::Context'); |
|
|
3801 |
$module->mock( 'userenv', sub { { branch => $library->id } } ); |
3805 |
$module->mock( 'userenv', sub { { branch => $library->id } } ); |
3802 |
|
3806 |
|
3803 |
my $patron = $builder->build_object( |
3807 |
my $patron = $builder->build_object( |
Lines 4599-4604
subtest 'Checkout should correctly terminate a transfer' => sub {
Link Here
|
4599 |
$hold = $hold->get_from_storage; |
4603 |
$hold = $hold->get_from_storage; |
4600 |
is( $hold->found, undef, 'Hold is waiting' ); |
4604 |
is( $hold->found, undef, 'Hold is waiting' ); |
4601 |
is( $hold->priority, 1, ); |
4605 |
is( $hold->priority, 1, ); |
|
|
4606 |
} |
4607 |
|
4608 |
subtest 'AddIssue records issuer if appropriate' => sub { |
4609 |
plan tests => 2; |
4610 |
|
4611 |
$module->mock( 'userenv', sub { { branch => $library->{id} } } ); |
4612 |
|
4613 |
my $library = |
4614 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
4615 |
my $patron = $builder->build_object( |
4616 |
{ |
4617 |
class => 'Koha::Patrons', |
4618 |
value => { categorycode => $patron_category->{categorycode} } |
4619 |
} |
4620 |
)->store; |
4621 |
my $issuer = $builder->build_object( |
4622 |
{ |
4623 |
class => 'Koha::Patrons', |
4624 |
value => { categorycode => $patron_category->{categorycode} } |
4625 |
} |
4626 |
)->store; |
4627 |
my $item = $builder->build_sample_item( |
4628 |
{ |
4629 |
library => $library->{branchcode} |
4630 |
} |
4631 |
); |
4632 |
|
4633 |
$module->mock( 'userenv', sub { { branch => $library->id, number => $issuer->{borrowernumber} } } ); |
4634 |
|
4635 |
my $dt_from = dt_from_string(); |
4636 |
my $dt_to = dt_from_string()->add( days => 7 ); |
4637 |
|
4638 |
my $issue = |
4639 |
AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); |
4640 |
|
4641 |
is( $issue->issuer, undef, "Issuer not recorded when RecordIssuer turned off" ); |
4642 |
|
4643 |
t::lib::Mocks::mock_preference('RecordIssuer', 1); |
4644 |
|
4645 |
my $issue2 = |
4646 |
AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); |
4647 |
|
4648 |
is( $issue->issuer, $issuer->{borrowernumber}, "Issuer recorded when RecordIssuer turned on" ); |
4602 |
}; |
4649 |
}; |
4603 |
|
4650 |
|
4604 |
$schema->storage->txn_rollback; |
4651 |
$schema->storage->txn_rollback; |