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 121-126
for my $branch ( $branches->next ) {
Link Here
|
121 |
$dbh->do('DELETE FROM issues'); |
121 |
$dbh->do('DELETE FROM issues'); |
122 |
$dbh->do('DELETE FROM borrowers'); |
122 |
$dbh->do('DELETE FROM borrowers'); |
123 |
|
123 |
|
|
|
124 |
# Disable recording of issuer until we're ready for it |
125 |
t::lib::Mocks::mock_preference('RecordIssuer', 0); |
126 |
|
127 |
my $module = new Test::MockModule('C4::Context'); |
128 |
|
124 |
my $library = $builder->build({ |
129 |
my $library = $builder->build({ |
125 |
source => 'Branch', |
130 |
source => 'Branch', |
126 |
}); |
131 |
}); |
Lines 3313-3319
subtest 'Incremented fee tests' => sub {
Link Here
|
3313 |
my $library = |
3318 |
my $library = |
3314 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
3319 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
3315 |
|
3320 |
|
3316 |
my $module = Test::MockModule->new('C4::Context'); |
|
|
3317 |
$module->mock( 'userenv', sub { { branch => $library->id } } ); |
3321 |
$module->mock( 'userenv', sub { { branch => $library->id } } ); |
3318 |
|
3322 |
|
3319 |
my $patron = $builder->build_object( |
3323 |
my $patron = $builder->build_object( |
Lines 4115-4120
subtest 'Checkout should correctly terminate a transfer' => sub {
Link Here
|
4115 |
$hold = $hold->get_from_storage; |
4119 |
$hold = $hold->get_from_storage; |
4116 |
is( $hold->found, undef, 'Hold is waiting' ); |
4120 |
is( $hold->found, undef, 'Hold is waiting' ); |
4117 |
is( $hold->priority, 1, ); |
4121 |
is( $hold->priority, 1, ); |
|
|
4122 |
} |
4123 |
|
4124 |
subtest 'AddIssue records issuer if appropriate' => sub { |
4125 |
plan tests => 2; |
4126 |
|
4127 |
$module->mock( 'userenv', sub { { branch => $library->{id} } } ); |
4128 |
|
4129 |
my $library = |
4130 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
4131 |
my $patron = $builder->build_object( |
4132 |
{ |
4133 |
class => 'Koha::Patrons', |
4134 |
value => { categorycode => $patron_category->{categorycode} } |
4135 |
} |
4136 |
)->store; |
4137 |
my $issuer = $builder->build_object( |
4138 |
{ |
4139 |
class => 'Koha::Patrons', |
4140 |
value => { categorycode => $patron_category->{categorycode} } |
4141 |
} |
4142 |
)->store; |
4143 |
my $item = $builder->build_sample_item( |
4144 |
{ |
4145 |
library => $library->{branchcode} |
4146 |
} |
4147 |
); |
4148 |
|
4149 |
$module->mock( 'userenv', sub { { branch => $library->id, number => $issuer->{borrowernumber} } } ); |
4150 |
|
4151 |
my $dt_from = dt_from_string(); |
4152 |
my $dt_to = dt_from_string()->add( days => 7 ); |
4153 |
|
4154 |
my $issue = |
4155 |
AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); |
4156 |
|
4157 |
is( $issue->issuer, undef, "Issuer not recorded when RecordIssuer turned off" ); |
4158 |
|
4159 |
t::lib::Mocks::mock_preference('RecordIssuer', 1); |
4160 |
|
4161 |
my $issue2 = |
4162 |
AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); |
4163 |
|
4164 |
is( $issue->issuer, $issuer->{borrowernumber}, "Issuer recorded when RecordIssuer turned on" ); |
4118 |
}; |
4165 |
}; |
4119 |
|
4166 |
|
4120 |
$schema->storage->txn_rollback; |
4167 |
$schema->storage->txn_rollback; |