Bug 33055: (bug 32624 follow-up) Unit tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Nick Clemens 2023-02-23 15:32:21 +00:00 committed by Tomas Cohen Arazi
parent 0307c1bbff
commit 0324aed470
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -276,7 +276,7 @@ $schema->storage->txn_rollback;
subtest "NoIssuesChargeGuarantees tests" => sub {
plan tests => 5;
plan tests => 6;
t::lib::Mocks::mock_preference( 'borrowerRelationship', 'parent' );
@ -320,13 +320,14 @@ subtest "NoIssuesChargeGuarantees tests" => sub {
is( $sip_patron->fines_amount, 0.11,"Guarantee only fines correctly counted");
ok( $sip_patron->charge_ok, "Guarantee not blocked by guarantor fines");
unlike( $sip_patron->screen_msg, qr/Patron blocked by fines .* on guaranteed accounts/,"Screen message does not include blocked message");
$schema->storage->txn_rollback;
};
subtest "NoIssuesChargeGuarantorsWithGuarantees tests" => sub {
plan tests => 6;
plan tests => 12;
t::lib::Mocks::mock_preference( 'borrowerRelationship', 'parent' );
@ -361,15 +362,29 @@ subtest "NoIssuesChargeGuarantorsWithGuarantees tests" => sub {
my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber );
is( $sip_patron->fines_amount, 11, "Guarantee fines correctly included");
is( $sip_patron->fines_amount, 11, "Personal fines correctly reported");
ok( !$sip_patron->charge_ok, "Guarantor blocked");
like( $sip_patron->screen_msg, qr/Patron blocked by fines \(11\.11\) on related accounts/,"Screen message includes related fines total");
$sip_patron = C4::SIP::ILS::Patron->new( $child->cardnumber );
is( $sip_patron->fines_amount, 0.11, "Guarantor fines correctly included");
is( $sip_patron->fines_amount, 0.11, "Personal fines correctly reported");
ok( !$sip_patron->charge_ok, "Guarantee blocked");
like( $sip_patron->screen_msg, qr/Patron blocked by fines \(11\.11\) on related accounts/,"Screen message includes related fines total");
t::lib::Mocks::mock_preference('NoIssuesChargeGuarantorsWithGuarantees', 12.01);
$sip_patron = C4::SIP::ILS::Patron->new( $child->cardnumber );
is( $sip_patron->fines_amount, 0.11, "Personal fines correctly reported");
ok( $sip_patron->charge_ok, "Guarantee not blocked");
unlike( $sip_patron->screen_msg, qr/Patron blocked by fines .* on related accounts/,"Screen message does not indicate block");
$sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber );
is( $sip_patron->fines_amount, 11, "Personal fines correctly reported");
ok( $sip_patron->charge_ok, "Patron not blocked");
unlike( $sip_patron->screen_msg, qr/Patron blocked by fines .* on related accounts/,"Screen message does not indicate block");
$schema->storage->txn_rollback;
};