|
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 3084-3090
subtest 'Incremented fee tests' => sub {
Link Here
|
| 3084 |
my $library = |
3089 |
my $library = |
| 3085 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
3090 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
| 3086 |
|
3091 |
|
| 3087 |
my $module = new Test::MockModule('C4::Context'); |
|
|
| 3088 |
$module->mock( 'userenv', sub { { branch => $library->id } } ); |
3092 |
$module->mock( 'userenv', sub { { branch => $library->id } } ); |
| 3089 |
|
3093 |
|
| 3090 |
my $patron = $builder->build_object( |
3094 |
my $patron = $builder->build_object( |
|
Lines 3316-3321
subtest 'CanBookBeIssued & RentalFeesCheckoutConfirmation' => sub {
Link Here
|
| 3316 |
$itemtype->rentalcharge_daily('0')->store; |
3320 |
$itemtype->rentalcharge_daily('0')->store; |
| 3317 |
}; |
3321 |
}; |
| 3318 |
|
3322 |
|
|
|
3323 |
subtest 'AddIssue records issuer if appropriate' => sub { |
| 3324 |
plan tests => 2; |
| 3325 |
|
| 3326 |
$module->mock( 'userenv', sub { { branch => $library->{id} } } ); |
| 3327 |
|
| 3328 |
my $library = |
| 3329 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
| 3330 |
my $patron = $builder->build_object( |
| 3331 |
{ |
| 3332 |
class => 'Koha::Patrons', |
| 3333 |
value => { categorycode => $patron_category->{categorycode} } |
| 3334 |
} |
| 3335 |
)->store; |
| 3336 |
my $issuer = $builder->build_object( |
| 3337 |
{ |
| 3338 |
class => 'Koha::Patrons', |
| 3339 |
value => { categorycode => $patron_category->{categorycode} } |
| 3340 |
} |
| 3341 |
)->store; |
| 3342 |
my $item = $builder->build_sample_item( |
| 3343 |
{ |
| 3344 |
library => $library->{branchcode} |
| 3345 |
} |
| 3346 |
); |
| 3347 |
|
| 3348 |
$module->mock( 'userenv', sub { { branch => $library->id, number => $issuer->{borrowernumber} } } ); |
| 3349 |
|
| 3350 |
my $dt_from = dt_from_string(); |
| 3351 |
my $dt_to = dt_from_string()->add( days => 7 ); |
| 3352 |
|
| 3353 |
my $issue = |
| 3354 |
AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); |
| 3355 |
|
| 3356 |
is( $issue->issuer, undef, "Issuer not recorded when RecordIssuer turned off" ); |
| 3357 |
|
| 3358 |
t::lib::Mocks::mock_preference('RecordIssuer', 1); |
| 3359 |
|
| 3360 |
my $issue2 = |
| 3361 |
AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); |
| 3362 |
|
| 3363 |
is( $issue->issuer, $issuer->{borrowernumber}, "Issuer recorded when RecordIssuer turned on" ); |
| 3364 |
}; |
| 3365 |
|
| 3319 |
$schema->storage->txn_rollback; |
3366 |
$schema->storage->txn_rollback; |
| 3320 |
C4::Context->clear_syspref_cache(); |
3367 |
C4::Context->clear_syspref_cache(); |
| 3321 |
$cache->clear_from_cache('single_holidays'); |
3368 |
$cache->clear_from_cache('single_holidays'); |