From 962cebd4844183be447f7b43cbe6c353f924bd30 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 23 Oct 2019 16:39:39 +0100 Subject: [PATCH] Bug 23049: (QA follow-up) Explicitly set accounttype/debit_type in tests This patch corrects an incorrect ternary and move the definitions into the test_data array to clarify their intent. Signed-off-by: Marcel de Rooy Signed-off-by: Martin Renvoize --- t/db_dependent/Accounts.t | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/t/db_dependent/Accounts.t b/t/db_dependent/Accounts.t index 0611f846e3..179e970f1c 100644 --- a/t/db_dependent/Accounts.t +++ b/t/db_dependent/Accounts.t @@ -124,23 +124,31 @@ my $sth = $dbh->prepare( my $days = 5; my @test_data = ( - { amount => 0 , days_ago => 0 , description =>'purge_zero_balance_fees should not delete 0 balance fees with date today' , delete => 0 } , - { amount => 0 , days_ago => $days - 1 , description =>'purge_zero_balance_fees should not delete 0 balance fees with date before threshold day' , delete => 0 } , - { amount => 0 , days_ago => $days , description =>'purge_zero_balance_fees should not delete 0 balance fees with date on threshold day' , delete => 0 } , - { amount => 0 , days_ago => $days + 1 , description =>'purge_zero_balance_fees should delete 0 balance fees with date after threshold day' , delete => 1 } , - { amount => undef , days_ago => $days + 1 , description =>'purge_zero_balance_fees should delete NULL balance fees with date after threshold day' , delete => 1 } , - { amount => 5 , days_ago => $days - 1 , description =>'purge_zero_balance_fees should not delete fees with positive amout owed before threshold day' , delete => 0 } , - { amount => 5 , days_ago => $days , description =>'purge_zero_balance_fees should not delete fees with positive amout owed on threshold day' , delete => 0 } , - { amount => 5 , days_ago => $days + 1 , description =>'purge_zero_balance_fees should not delete fees with positive amout owed after threshold day' , delete => 0 } , - { amount => -5 , days_ago => $days - 1 , description =>'purge_zero_balance_fees should not delete fees with negative amout owed before threshold day' , delete => 0 } , - { amount => -5 , days_ago => $days , description =>'purge_zero_balance_fees should not delete fees with negative amout owed on threshold day' , delete => 0 } , - { amount => -5 , days_ago => $days + 1 , description =>'purge_zero_balance_fees should not delete fees with negative amout owed after threshold day' , delete => 0 } + { amount => 0 , days_ago => 0 , description =>'purge_zero_balance_fees should not delete 0 balance fees with date today' , delete => 0, accounttype => undef, debit_type => 'OVERDUE' } , + { amount => 0 , days_ago => $days - 1 , description =>'purge_zero_balance_fees should not delete 0 balance fees with date before threshold day' , delete => 0, accounttype => undef, debit_type => 'OVERDUE' } , + { amount => 0 , days_ago => $days , description =>'purge_zero_balance_fees should not delete 0 balance fees with date on threshold day' , delete => 0, accounttype => undef, debit_type => 'OVERDUE' } , + { amount => 0 , days_ago => $days + 1 , description =>'purge_zero_balance_fees should delete 0 balance fees with date after threshold day' , delete => 1, accounttype => undef, debit_type => 'OVERDUE' } , + { amount => undef , days_ago => $days + 1 , description =>'purge_zero_balance_fees should delete NULL balance fees with date after threshold day' , delete => 1, accounttype => undef, debit_type => 'OVERDUE' } , + { amount => 5 , days_ago => $days - 1 , description =>'purge_zero_balance_fees should not delete fees with positive amout owed before threshold day' , delete => 0, accounttype => undef, debit_type => 'OVERDUE' } , + { amount => 5 , days_ago => $days , description =>'purge_zero_balance_fees should not delete fees with positive amout owed on threshold day' , delete => 0, accounttype => undef, debit_type => 'OVERDUE' } , + { amount => 5 , days_ago => $days + 1 , description =>'purge_zero_balance_fees should not delete fees with positive amout owed after threshold day' , delete => 0, accounttype => undef, debit_type => 'OVERDUE' } , + { amount => -5 , days_ago => $days - 1 , description =>'purge_zero_balance_fees should not delete fees with negative amout owed before threshold day' , delete => 0, accounttype => 'Pay', debit_type => undef } , + { amount => -5 , days_ago => $days , description =>'purge_zero_balance_fees should not delete fees with negative amout owed on threshold day' , delete => 0, accounttype => 'Pay', debit_type => undef } , + { amount => -5 , days_ago => $days + 1 , description =>'purge_zero_balance_fees should not delete fees with negative amout owed after threshold day' , delete => 0, accounttype => 'Pay', debit_type => undef } ); my $categorycode = $builder->build({ source => 'Category' })->{categorycode}; my $borrower = Koha::Patron->new( { firstname => 'Test', surname => 'Patron', categorycode => $categorycode, branchcode => $branchcode } )->store(); for my $data ( @test_data ) { - $sth->execute($borrower->borrowernumber, $data->{amount}, $data->{days_ago}, $data->{description}, 'commandline', $data->{amount} > 0 ? 'W' : undef, $data->{amount} >= 0 ? undef : 'OVERDUE' ); + $sth->execute( + $borrower->borrowernumber, + $data->{amount}, + $data->{days_ago}, + $data->{description}, + 'commandline', + $data->{accounttype}, + $data->{debit_type} + ); } purge_zero_balance_fees( $days ); -- 2.39.2