Bugzilla – Attachment 109357 Details for
Bug 19382
Add ability to block guarantees based on fees owed by guarantor and other guarantees
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19382: Tests refactoring [alternate]
Bug-19382-Tests-refactoring-alternate.patch (text/plain), 5.08 KB, created by
Kyle M Hall (khall)
on 2020-08-31 12:33:30 UTC
(
hide
)
Description:
Bug 19382: Tests refactoring [alternate]
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2020-08-31 12:33:30 UTC
Size:
5.08 KB
patch
obsolete
>From b2ed82403b2a34bed904bee8a65b1d2fdb514141 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 31 Aug 2020 08:33:05 -0400 >Subject: [PATCH] Bug 19382: Tests refactoring [alternate] > >--- > t/db_dependent/Koha/Patron.t | 66 ++++++------------------------------ > 1 file changed, 11 insertions(+), 55 deletions(-) > >diff --git a/t/db_dependent/Koha/Patron.t b/t/db_dependent/Koha/Patron.t >index 045c201fe5..d91d5b8128 100644 >--- a/t/db_dependent/Koha/Patron.t >+++ b/t/db_dependent/Koha/Patron.t >@@ -97,69 +97,25 @@ subtest 'relationships_debt() tests' => sub { > is( $parent_1->guarantee_relationships->guarantees->count, 2, 'Parent 1 has correct number of guarantors' ); > is( $parent_2->guarantee_relationships->guarantees->count, 2, 'Parent 2 has correct number of guarantors' ); > >- # 3 params, count from 0 to 7 in binary ( 3 places ) to get the set of switches, then do that 4 times, one for each parent and child >+ # 3 params, count from 0 to 6 in binary ( 3 places ) to get the set of switches, then do that 4 times, one for each parent and child > for my $i ( 0 .. 7 ) { > my ( $only_this_guarantor, $include_guarantors, $include_this_patron ) = split '', sprintf( "%03b", $i ); >- for my $patron ( $parent_1, $parent_2, $child_1, $child_2 ) { >- is( >- $patron->relationships_debt( >- { >- only_this_guarantor => $only_this_guarantor, >- include_guarantors => $include_guarantors, >- include_this_patron => $include_this_patron >- } >- ), 0, 'Family debt is correct' >- ); >+ for my $patron ( $child_1, $child_2, $parent_1, $parent_2 ) { >+ is( $patron->relationships_debt( { only_this_guarantor => $only_this_guarantor, include_guarantors => $include_guarantors, include_this_patron => $include_this_patron } ), 0, 'Family debt is correct' ); > } > } > >- >- my $child_2_debt = 10; >- $child_2->account->add_debit({ type => 'ACCOUNT', amount => $child_2_debt, interface => 'commandline' }); >+ $child_2->account->add_debit({ type => 'ACCOUNT', amount => 10, interface => 'commandline' }); > is( $child_2->account->non_issues_charges, 10, 'Child 2 owes correct amount' ); >+ > for my $i ( 0 .. 7 ) { > my ( $only_this_guarantor, $include_guarantors, $include_this_patron ) = split '', sprintf( "%03b", $i ); >- is( >- $parent_1->relationships_debt( >- { >- only_this_guarantor => $only_this_guarantor, >- include_guarantors => $include_guarantors, >- include_this_patron => $include_this_patron >- } >- ), >- $child_2_debt, "parent 1 debt is correct (only_this_guarantor => $only_this_guarantor, include_guarantors => $include_guarantors, include_this_patron => $include_this_patron" >- ); >- is( >- $parent_2->relationships_debt( >- { >- only_this_guarantor => $only_this_guarantor, >- include_guarantors => $include_guarantors, >- include_this_patron => $include_this_patron >- } >- ), >- $child_2_debt, "parent 2 debt is correct (only_this_guarantor => $only_this_guarantor, include_guarantors => $include_guarantors, include_this_patron => $include_this_patron" >- ); >- is( >- $child_1->relationships_debt( >- { >- only_this_guarantor => $only_this_guarantor, >- include_guarantors => $include_guarantors, >- include_this_patron => $include_this_patron >- } >- ), >- $child_2_debt, "child 1 debt is correct (only_this_guarantor => $only_this_guarantor, include_guarantors => $include_guarantors, include_this_patron => $include_this_patron" >- ); >- >- is( >- $child_2->relationships_debt( >- { >- only_this_guarantor => $only_this_guarantor, >- include_guarantors => $include_guarantors, >- include_this_patron => $include_this_patron >- } >- ), >- ( $include_this_patron && $child_2_debt ) ? $child_2_debt : 0, "child 2 debt is correct (only_this_guarantor => $only_this_guarantor, include_guarantors => $include_guarantors, include_this_patron => $include_this_patron" >- ); >+ for my $patron ( $child_1, $child_2, $parent_1, $parent_2 ) { >+ my $amount = 10; >+ $amount = 0 if ( $patron->id == $child_1->id && $i > 3 ); >+ $amount = 0 if ( $patron->id == $child_2->id && ( $i == 0 || $i == 2 || $i == 4 || $i == 5 || $i == 6 ) ); >+ is( $patron->relationships_debt( { only_this_guarantor => $only_this_guarantor, include_guarantors => $include_guarantors, include_this_patron => $include_this_patron } ), $amount, 'Family debt is correct' ); >+ } > } > > $parent_1->account->add_debit({ type => 'ACCOUNT', amount => 10, interface => 'commandline' }); >-- >2.24.1 (Apple Git-126)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 19382
:
97234
|
97235
|
97303
|
99196
|
102090
|
106534
|
107344
|
109210
|
109211
|
109349
|
109357
|
109634
|
109635
|
109636
|
109841
|
109937
|
111570
|
111571
|
111572
|
111573
|
111574
|
111609