Lines 18-24
Link Here
|
18 |
|
18 |
|
19 |
use Modern::Perl; |
19 |
use Modern::Perl; |
20 |
|
20 |
|
21 |
use Test::More tests => 24; |
21 |
use Test::More tests => 30; |
22 |
use Test::MockModule; |
22 |
use Test::MockModule; |
23 |
use Test::Warn; |
23 |
use Test::Warn; |
24 |
|
24 |
|
Lines 133-138
for my $data (@test_data) {
Link Here
|
133 |
is_delete_correct( $data->{delete}, $data->{description}); |
133 |
is_delete_correct( $data->{delete}, $data->{description}); |
134 |
} |
134 |
} |
135 |
|
135 |
|
|
|
136 |
$dbh->do(q|DELETE FROM accountlines|); |
137 |
my $debit = Koha::Account::Line->new({ borrowernumber => $borrower->id, date => '1900-01-01', amountoutstanding => 0 })->store(); |
138 |
my $credit = Koha::Account::Line->new({ borrowernumber => $borrower->id, date => '1900-01-01', amountoutstanding => -5 })->store(); |
139 |
my $offset = Koha::Account::Offset->new({ credit_id => $credit->id, debit_id => $debit->id, type => 'Payment' })->store(); |
140 |
purge_zero_balance_fees( 1 ); |
141 |
my $debit_2 = Koha::Account::Lines->find( $debit->id ); |
142 |
my $credit_2 = Koha::Account::Lines->find( $credit->id ); |
143 |
ok( $debit_2, 'Debit was correctly not deleted when credit has balance' ); |
144 |
ok( $credit_2, 'Credit was correctly not deleted when credit has balance' ); |
145 |
|
146 |
$dbh->do(q|DELETE FROM accountlines|); |
147 |
$debit = Koha::Account::Line->new({ borrowernumber => $borrower->id, date => '1900-01-01', amountoutstanding => 5 })->store(); |
148 |
$credit = Koha::Account::Line->new({ borrowernumber => $borrower->id, date => '1900-01-01', amountoutstanding => 0 })->store(); |
149 |
$offset = Koha::Account::Offset->new({ credit_id => $credit->id, debit_id => $debit->id, type => 'Payment' })->store(); |
150 |
purge_zero_balance_fees( 1 ); |
151 |
$debit_2 = $credit_2 = undef; |
152 |
$debit_2 = Koha::Account::Lines->find( $debit->id ); |
153 |
$credit_2 = Koha::Account::Lines->find( $credit->id ); |
154 |
ok( $debit_2, 'Debit was correctly not deleted when debit has balance' ); |
155 |
ok( $credit_2, 'Credit was correctly not deleted when debit has balance' ); |
156 |
|
157 |
$dbh->do(q|DELETE FROM accountlines|); |
158 |
$debit = Koha::Account::Line->new({ borrowernumber => $borrower->id, date => '1900-01-01', amountoutstanding => 0 })->store(); |
159 |
$credit = Koha::Account::Line->new({ borrowernumber => $borrower->id, date => '1900-01-01', amountoutstanding => 0 })->store(); |
160 |
$offset = Koha::Account::Offset->new({ credit_id => $credit->id, debit_id => $debit->id, type => 'Payment' })->store(); |
161 |
purge_zero_balance_fees( 1 ); |
162 |
$debit_2 = Koha::Account::Lines->find( $debit->id ); |
163 |
$credit_2 = Koha::Account::Lines->find( $credit->id ); |
164 |
ok( !$debit_2, 'Debit was correctly deleted' ); |
165 |
ok( !$credit_2, 'Credit was correctly deleted' ); |
166 |
|
136 |
$dbh->do(q|DELETE FROM accountlines|); |
167 |
$dbh->do(q|DELETE FROM accountlines|); |
137 |
|
168 |
|
138 |
subtest "Koha::Account::pay tests" => sub { |
169 |
subtest "Koha::Account::pay tests" => sub { |
139 |
- |
|
|