|
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 3345-3351
subtest 'Incremented fee tests' => sub {
Link Here
|
| 3345 |
my $library = |
3350 |
my $library = |
| 3346 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
3351 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
| 3347 |
|
3352 |
|
| 3348 |
my $module = Test::MockModule->new('C4::Context'); |
|
|
| 3349 |
$module->mock( 'userenv', sub { { branch => $library->id } } ); |
3353 |
$module->mock( 'userenv', sub { { branch => $library->id } } ); |
| 3350 |
|
3354 |
|
| 3351 |
my $patron = $builder->build_object( |
3355 |
my $patron = $builder->build_object( |
|
Lines 4147-4152
subtest 'Checkout should correctly terminate a transfer' => sub {
Link Here
|
| 4147 |
$hold = $hold->get_from_storage; |
4151 |
$hold = $hold->get_from_storage; |
| 4148 |
is( $hold->found, undef, 'Hold is waiting' ); |
4152 |
is( $hold->found, undef, 'Hold is waiting' ); |
| 4149 |
is( $hold->priority, 1, ); |
4153 |
is( $hold->priority, 1, ); |
|
|
4154 |
} |
| 4155 |
|
| 4156 |
subtest 'AddIssue records issuer if appropriate' => sub { |
| 4157 |
plan tests => 2; |
| 4158 |
|
| 4159 |
$module->mock( 'userenv', sub { { branch => $library->{id} } } ); |
| 4160 |
|
| 4161 |
my $library = |
| 4162 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
| 4163 |
my $patron = $builder->build_object( |
| 4164 |
{ |
| 4165 |
class => 'Koha::Patrons', |
| 4166 |
value => { categorycode => $patron_category->{categorycode} } |
| 4167 |
} |
| 4168 |
)->store; |
| 4169 |
my $issuer = $builder->build_object( |
| 4170 |
{ |
| 4171 |
class => 'Koha::Patrons', |
| 4172 |
value => { categorycode => $patron_category->{categorycode} } |
| 4173 |
} |
| 4174 |
)->store; |
| 4175 |
my $item = $builder->build_sample_item( |
| 4176 |
{ |
| 4177 |
library => $library->{branchcode} |
| 4178 |
} |
| 4179 |
); |
| 4180 |
|
| 4181 |
$module->mock( 'userenv', sub { { branch => $library->id, number => $issuer->{borrowernumber} } } ); |
| 4182 |
|
| 4183 |
my $dt_from = dt_from_string(); |
| 4184 |
my $dt_to = dt_from_string()->add( days => 7 ); |
| 4185 |
|
| 4186 |
my $issue = |
| 4187 |
AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); |
| 4188 |
|
| 4189 |
is( $issue->issuer, undef, "Issuer not recorded when RecordIssuer turned off" ); |
| 4190 |
|
| 4191 |
t::lib::Mocks::mock_preference('RecordIssuer', 1); |
| 4192 |
|
| 4193 |
my $issue2 = |
| 4194 |
AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); |
| 4195 |
|
| 4196 |
is( $issue->issuer, $issuer->{borrowernumber}, "Issuer recorded when RecordIssuer turned on" ); |
| 4150 |
}; |
4197 |
}; |
| 4151 |
|
4198 |
|
| 4152 |
$schema->storage->txn_rollback; |
4199 |
$schema->storage->txn_rollback; |