Lines 4-10
Link Here
|
4 |
# This needs to be extended! Your help is appreciated.. |
4 |
# This needs to be extended! Your help is appreciated.. |
5 |
|
5 |
|
6 |
use Modern::Perl; |
6 |
use Modern::Perl; |
7 |
use Test::More tests => 9; |
7 |
use Test::More tests => 10; |
8 |
|
8 |
|
9 |
use t::lib::Mocks; |
9 |
use t::lib::Mocks; |
10 |
use t::lib::TestBuilder; |
10 |
use t::lib::TestBuilder; |
Lines 274-282
subtest "fine_items tests" => sub {
Link Here
|
274 |
|
274 |
|
275 |
$schema->storage->txn_rollback; |
275 |
$schema->storage->txn_rollback; |
276 |
|
276 |
|
|
|
277 |
subtest "NoIssuesChargeGuarantees tests" => sub { |
278 |
|
279 |
plan tests => 4; |
280 |
|
281 |
t::lib::Mocks::mock_preference( 'borrowerRelationship', 'parent' ); |
282 |
|
283 |
$schema->storage->txn_begin; |
284 |
|
285 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
286 |
my $child = $builder->build_object({ class => 'Koha::Patrons' }); |
287 |
$child->add_guarantor({ guarantor_id => $patron->borrowernumber, relationship => 'parent' }); |
288 |
|
289 |
t::lib::Mocks::mock_preference('NoIssuesChargeGuarantees', 1); |
290 |
|
291 |
my $fee1 = $builder->build_object( |
292 |
{ |
293 |
class => 'Koha::Account::Lines', |
294 |
value => { |
295 |
borrowernumber => $patron->borrowernumber, |
296 |
amountoutstanding => 11, |
297 |
} |
298 |
} |
299 |
)->store; |
300 |
|
301 |
my $fee2 = $builder->build_object( |
302 |
{ |
303 |
class => 'Koha::Account::Lines', |
304 |
value => { |
305 |
borrowernumber => $child->borrowernumber, |
306 |
amountoutstanding => 0.11, |
307 |
} |
308 |
} |
309 |
)->store; |
310 |
|
311 |
my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber ); |
312 |
|
313 |
is( $sip_patron->fines_amount, 11.11,"Guarantor fines correctly included"); |
314 |
ok( !$sip_patron->charge_ok, "Guarantor blocked"); |
315 |
|
316 |
$sip_patron = C4::SIP::ILS::Patron->new( $child->cardnumber ); |
317 |
|
318 |
is( $sip_patron->fines_amount, 0.11,"Guarantee only fines correctly counted"); |
319 |
ok( $sip_patron->charge_ok, "Guarantee not blocked by guarantor fines"); |
320 |
|
321 |
$schema->storage->txn_rollback; |
322 |
}; |
323 |
|
277 |
subtest "NoIssuesChargeGuarantorsWithGuarantees tests" => sub { |
324 |
subtest "NoIssuesChargeGuarantorsWithGuarantees tests" => sub { |
278 |
|
325 |
|
279 |
plan tests => 1; |
326 |
plan tests => 4; |
280 |
|
327 |
|
281 |
t::lib::Mocks::mock_preference( 'borrowerRelationship', 'parent' ); |
328 |
t::lib::Mocks::mock_preference( 'borrowerRelationship', 'parent' ); |
282 |
|
329 |
|
Lines 311-316
subtest "NoIssuesChargeGuarantorsWithGuarantees tests" => sub {
Link Here
|
311 |
my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber ); |
358 |
my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber ); |
312 |
|
359 |
|
313 |
is( $sip_patron->fines_amount, 11.11,"Guarantee fines correctly included"); |
360 |
is( $sip_patron->fines_amount, 11.11,"Guarantee fines correctly included"); |
|
|
361 |
ok( !$sip_patron->charge_ok, "Guarantor blocked"); |
362 |
|
363 |
$sip_patron = C4::SIP::ILS::Patron->new( $child->cardnumber ); |
364 |
|
365 |
is( $sip_patron->fines_amount, 11.11,"Guarantor fines correctly included"); |
366 |
ok( !$sip_patron->charge_ok, "Guarantee blocked"); |
314 |
|
367 |
|
315 |
$schema->storage->txn_rollback; |
368 |
$schema->storage->txn_rollback; |
316 |
}; |
369 |
}; |
317 |
- |
|
|