Lines 59-65
$dbh->do(q|DELETE FROM issues|);
Link Here
|
59 |
$dbh->do(q|DELETE FROM borrowers|); |
59 |
$dbh->do(q|DELETE FROM borrowers|); |
60 |
|
60 |
|
61 |
my $branchcode = 'CPL'; |
61 |
my $branchcode = 'CPL'; |
62 |
my $borrower_number; |
|
|
63 |
|
62 |
|
64 |
my $context = new Test::MockModule('C4::Context'); |
63 |
my $context = new Test::MockModule('C4::Context'); |
65 |
$context->mock( 'userenv', sub { |
64 |
$context->mock( 'userenv', sub { |
Lines 77-83
$context->mock( 'userenv', sub {
Link Here
|
77 |
# 1 => yesterday |
76 |
# 1 => yesterday |
78 |
# etc. |
77 |
# etc. |
79 |
|
78 |
|
80 |
$sth = $dbh->prepare( |
79 |
my $sth = $dbh->prepare( |
81 |
"INSERT INTO accountlines ( |
80 |
"INSERT INTO accountlines ( |
82 |
borrowernumber, |
81 |
borrowernumber, |
83 |
amountoutstanding, |
82 |
amountoutstanding, |
Lines 95-109
my @test_data = (
Link Here
|
95 |
{ amount => 0 , days_ago => $days , description =>'purge_zero_balance_fees should not delete 0 balance fees with date on threshold day' , delete => 0 } , |
94 |
{ amount => 0 , days_ago => $days , description =>'purge_zero_balance_fees should not delete 0 balance fees with date on threshold day' , delete => 0 } , |
96 |
{ amount => 0 , days_ago => $days + 1 , description =>'purge_zero_balance_fees should delete 0 balance fees with date after threshold day' , delete => 1 } , |
95 |
{ amount => 0 , days_ago => $days + 1 , description =>'purge_zero_balance_fees should delete 0 balance fees with date after threshold day' , delete => 1 } , |
97 |
{ amount => undef , days_ago => $days + 1 , description =>'purge_zero_balance_fees should delete NULL balance fees with date after threshold day' , delete => 1 } , |
96 |
{ amount => undef , days_ago => $days + 1 , description =>'purge_zero_balance_fees should delete NULL balance fees with date after threshold day' , delete => 1 } , |
98 |
{ amount => 5 , days_ago => $days - 1 , description =>'purge_zero_balance_fees should not delete fees with postive amout owed before threshold day' , delete => 0 } , |
97 |
{ amount => 5 , days_ago => $days - 1 , description =>'purge_zero_balance_fees should not delete fees with positive amout owed before threshold day' , delete => 0 } , |
99 |
{ amount => 5 , days_ago => $days , description =>'purge_zero_balance_fees should not delete fees with postive amout owed on threshold day' , delete => 0 } , |
98 |
{ amount => 5 , days_ago => $days , description =>'purge_zero_balance_fees should not delete fees with positive amout owed on threshold day' , delete => 0 } , |
100 |
{ amount => 5 , days_ago => $days + 1 , description =>'purge_zero_balance_fees should not delete fees with postive amout owed after threshold day' , delete => 0 } , |
99 |
{ amount => 5 , days_ago => $days + 1 , description =>'purge_zero_balance_fees should not delete fees with positive amout owed after threshold day' , delete => 0 } , |
101 |
{ amount => -5 , days_ago => $days - 1 , description =>'purge_zero_balance_fees should not delete fees with negative amout owed before threshold day' , delete => 0 } , |
100 |
{ amount => -5 , days_ago => $days - 1 , description =>'purge_zero_balance_fees should not delete fees with negative amout owed before threshold day' , delete => 0 } , |
102 |
{ amount => -5 , days_ago => $days , description =>'purge_zero_balance_fees should not delete fees with negative amout owed on threshold day' , delete => 0 } , |
101 |
{ amount => -5 , days_ago => $days , description =>'purge_zero_balance_fees should not delete fees with negative amout owed on threshold day' , delete => 0 } , |
103 |
{ amount => -5 , days_ago => $days + 1 , description =>'purge_zero_balance_fees should not delete fees with negative amout owed after threshold day' , delete => 0 } |
102 |
{ amount => -5 , days_ago => $days + 1 , description =>'purge_zero_balance_fees should not delete fees with negative amout owed after threshold day' , delete => 0 } |
104 |
); |
103 |
); |
105 |
|
104 |
|
106 |
for my $data ( @test_data ) { |
105 |
my $borrower = Koha::Borrower->new( { firstname => 'Test', surname => 'Patron', categorycode => 'PT', branchcode => 'MPL' } )->store(); |
|
|
106 |
|
107 |
for my $data ( @test_data ) { |
107 |
$sth->execute($borrower->borrowernumber, $data->{amount}, $data->{days_ago}, $data->{description}); |
108 |
$sth->execute($borrower->borrowernumber, $data->{amount}, $data->{days_ago}, $data->{description}); |
108 |
} |
109 |
} |
109 |
|
110 |
|
Lines 128-133
for my $data (@test_data) {
Link Here
|
128 |
is_delete_correct( $data->{delete}, $data->{description}); |
129 |
is_delete_correct( $data->{delete}, $data->{description}); |
129 |
} |
130 |
} |
130 |
|
131 |
|
|
|
132 |
$dbh->do(q|DELETE FROM accountlines|); |
133 |
|
131 |
subtest "recordpayment() tests" => sub { |
134 |
subtest "recordpayment() tests" => sub { |
132 |
|
135 |
|
133 |
plan tests => 10; |
136 |
plan tests => 10; |
134 |
- |
|
|