|
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 => 45; |
21 |
use Test::More tests => 46; |
| 22 |
use Test::MockModule; |
22 |
use Test::MockModule; |
| 23 |
|
23 |
|
| 24 |
use Data::Dumper; |
24 |
use Data::Dumper; |
|
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 3106-3112
subtest 'Incremented fee tests' => sub {
Link Here
|
| 3106 |
my $library = |
3111 |
my $library = |
| 3107 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
3112 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
| 3108 |
|
3113 |
|
| 3109 |
my $module = new Test::MockModule('C4::Context'); |
|
|
| 3110 |
$module->mock( 'userenv', sub { { branch => $library->id } } ); |
3114 |
$module->mock( 'userenv', sub { { branch => $library->id } } ); |
| 3111 |
|
3115 |
|
| 3112 |
my $patron = $builder->build_object( |
3116 |
my $patron = $builder->build_object( |
|
Lines 3344-3349
subtest 'CanBookBeIssued & RentalFeesCheckoutConfirmation' => sub {
Link Here
|
| 3344 |
$itemtype->rentalcharge_daily('0')->store; |
3348 |
$itemtype->rentalcharge_daily('0')->store; |
| 3345 |
}; |
3349 |
}; |
| 3346 |
|
3350 |
|
|
|
3351 |
subtest 'AddIssue records issuer if appropriate' => sub { |
| 3352 |
plan tests => 2; |
| 3353 |
|
| 3354 |
$module->mock( 'userenv', sub { { branch => $library->{id} } } ); |
| 3355 |
|
| 3356 |
my $library = |
| 3357 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
| 3358 |
my $patron = $builder->build_object( |
| 3359 |
{ |
| 3360 |
class => 'Koha::Patrons', |
| 3361 |
value => { categorycode => $patron_category->{categorycode} } |
| 3362 |
} |
| 3363 |
)->store; |
| 3364 |
my $issuer = $builder->build_object( |
| 3365 |
{ |
| 3366 |
class => 'Koha::Patrons', |
| 3367 |
value => { categorycode => $patron_category->{categorycode} } |
| 3368 |
} |
| 3369 |
)->store; |
| 3370 |
my $item = $builder->build_sample_item( |
| 3371 |
{ |
| 3372 |
library => $library->{branchcode} |
| 3373 |
} |
| 3374 |
); |
| 3375 |
|
| 3376 |
$module->mock( 'userenv', sub { { branch => $library->id, number => $issuer->{borrowernumber} } } ); |
| 3377 |
|
| 3378 |
my $dt_from = dt_from_string(); |
| 3379 |
my $dt_to = dt_from_string()->add( days => 7 ); |
| 3380 |
|
| 3381 |
my $issue = |
| 3382 |
AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); |
| 3383 |
|
| 3384 |
is( $issue->issuer, undef, "Issuer not recorded when RecordIssuer turned off" ); |
| 3385 |
|
| 3386 |
t::lib::Mocks::mock_preference('RecordIssuer', 1); |
| 3387 |
|
| 3388 |
my $issue2 = |
| 3389 |
AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); |
| 3390 |
|
| 3391 |
is( $issue->issuer, $issuer->{borrowernumber}, "Issuer recorded when RecordIssuer turned on" ); |
| 3392 |
}; |
| 3393 |
|
| 3347 |
$schema->storage->txn_rollback; |
3394 |
$schema->storage->txn_rollback; |
| 3348 |
C4::Context->clear_syspref_cache(); |
3395 |
C4::Context->clear_syspref_cache(); |
| 3349 |
$cache->clear_from_cache('single_holidays'); |
3396 |
$cache->clear_from_cache('single_holidays'); |