Lines 81-87
$context->mock( 'userenv', sub {
Link Here
|
81 |
# 1 => yesterday |
81 |
# 1 => yesterday |
82 |
# etc. |
82 |
# etc. |
83 |
|
83 |
|
84 |
$sth = $dbh->prepare( |
84 |
my $sth = $dbh->prepare( |
85 |
"INSERT INTO accountlines ( |
85 |
"INSERT INTO accountlines ( |
86 |
borrowernumber, |
86 |
borrowernumber, |
87 |
amountoutstanding, |
87 |
amountoutstanding, |
Lines 99-113
my @test_data = (
Link Here
|
99 |
{ amount => 0 , days_ago => $days , description =>'purge_zero_balance_fees should not delete 0 balance fees with date on threshold day' , delete => 0 } , |
99 |
{ amount => 0 , days_ago => $days , description =>'purge_zero_balance_fees should not delete 0 balance fees with date on threshold day' , delete => 0 } , |
100 |
{ amount => 0 , days_ago => $days + 1 , description =>'purge_zero_balance_fees should delete 0 balance fees with date after threshold day' , delete => 1 } , |
100 |
{ amount => 0 , days_ago => $days + 1 , description =>'purge_zero_balance_fees should delete 0 balance fees with date after threshold day' , delete => 1 } , |
101 |
{ amount => undef , days_ago => $days + 1 , description =>'purge_zero_balance_fees should delete NULL balance fees with date after threshold day' , delete => 1 } , |
101 |
{ amount => undef , days_ago => $days + 1 , description =>'purge_zero_balance_fees should delete NULL balance fees with date after threshold day' , delete => 1 } , |
102 |
{ amount => 5 , days_ago => $days - 1 , description =>'purge_zero_balance_fees should not delete fees with postive amout owed before threshold day' , delete => 0 } , |
102 |
{ amount => 5 , days_ago => $days - 1 , description =>'purge_zero_balance_fees should not delete fees with positive amout owed before threshold day' , delete => 0 } , |
103 |
{ amount => 5 , days_ago => $days , description =>'purge_zero_balance_fees should not delete fees with postive amout owed on threshold day' , delete => 0 } , |
103 |
{ amount => 5 , days_ago => $days , description =>'purge_zero_balance_fees should not delete fees with positive amout owed on threshold day' , delete => 0 } , |
104 |
{ amount => 5 , days_ago => $days + 1 , description =>'purge_zero_balance_fees should not delete fees with postive amout owed after threshold day' , delete => 0 } , |
104 |
{ amount => 5 , days_ago => $days + 1 , description =>'purge_zero_balance_fees should not delete fees with positive amout owed after threshold day' , delete => 0 } , |
105 |
{ amount => -5 , days_ago => $days - 1 , description =>'purge_zero_balance_fees should not delete fees with negative amout owed before threshold day' , delete => 0 } , |
105 |
{ amount => -5 , days_ago => $days - 1 , description =>'purge_zero_balance_fees should not delete fees with negative amout owed before threshold day' , delete => 0 } , |
106 |
{ amount => -5 , days_ago => $days , description =>'purge_zero_balance_fees should not delete fees with negative amout owed on threshold day' , delete => 0 } , |
106 |
{ amount => -5 , days_ago => $days , description =>'purge_zero_balance_fees should not delete fees with negative amout owed on threshold day' , delete => 0 } , |
107 |
{ amount => -5 , days_ago => $days + 1 , description =>'purge_zero_balance_fees should not delete fees with negative amout owed after threshold day' , delete => 0 } |
107 |
{ amount => -5 , days_ago => $days + 1 , description =>'purge_zero_balance_fees should not delete fees with negative amout owed after threshold day' , delete => 0 } |
108 |
); |
108 |
); |
109 |
|
109 |
|
110 |
for my $data ( @test_data ) { |
110 |
my $borrower = Koha::Borrower->new( { firstname => 'Test', surname => 'Patron', categorycode => 'PT', branchcode => 'MPL' } )->store(); |
|
|
111 |
|
112 |
for my $data ( @test_data ) { |
111 |
$sth->execute($borrower->borrowernumber, $data->{amount}, $data->{days_ago}, $data->{description}); |
113 |
$sth->execute($borrower->borrowernumber, $data->{amount}, $data->{days_ago}, $data->{description}); |
112 |
} |
114 |
} |
113 |
|
115 |
|
Lines 132-137
for my $data (@test_data) {
Link Here
|
132 |
is_delete_correct( $data->{delete}, $data->{description}); |
134 |
is_delete_correct( $data->{delete}, $data->{description}); |
133 |
} |
135 |
} |
134 |
|
136 |
|
|
|
137 |
$dbh->do(q|DELETE FROM accountlines|); |
138 |
|
135 |
subtest "recordpayment() tests" => sub { |
139 |
subtest "recordpayment() tests" => sub { |
136 |
|
140 |
|
137 |
plan tests => 10; |
141 |
plan tests => 10; |
138 |
- |
|
|