Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 3; |
22 |
use Test::More tests => 4; |
23 |
|
23 |
|
24 |
use Koha::Account; |
24 |
use Koha::Account; |
25 |
use Koha::Account::Lines; |
25 |
use Koha::Account::Lines; |
Lines 192-194
subtest 'add_credit() tests' => sub {
Link Here
|
192 |
|
192 |
|
193 |
$schema->storage->txn_rollback; |
193 |
$schema->storage->txn_rollback; |
194 |
}; |
194 |
}; |
195 |
- |
195 |
|
|
|
196 |
subtest 'lines() tests' => sub { |
197 |
|
198 |
plan tests => 1; |
199 |
|
200 |
$schema->storage->txn_begin; |
201 |
|
202 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
203 |
my $account = $patron->account; |
204 |
|
205 |
my @generated_lines; |
206 |
|
207 |
# Add Credits |
208 |
push @generated_lines, $account->add_credit({ amount => 1 }); |
209 |
push @generated_lines, $account->add_credit({ amount => 2 }); |
210 |
push @generated_lines, $account->add_credit({ amount => 3 }); |
211 |
push @generated_lines, $account->add_credit({ amount => 4 }); |
212 |
|
213 |
# Add Debits |
214 |
push @generated_lines, Koha::Account::Line->new({ borrowernumber => $patron->id, amountoutstanding => 1 })->store; |
215 |
push @generated_lines, Koha::Account::Line->new({ borrowernumber => $patron->id, amountoutstanding => 2 })->store; |
216 |
push @generated_lines, Koha::Account::Line->new({ borrowernumber => $patron->id, amountoutstanding => 3 })->store; |
217 |
push @generated_lines, Koha::Account::Line->new({ borrowernumber => $patron->id, amountoutstanding => 4 })->store; |
218 |
|
219 |
# Paid Off |
220 |
push @generated_lines, Koha::Account::Line->new({ borrowernumber => $patron->id, amountoutstanding => 0 })->store; |
221 |
push @generated_lines, Koha::Account::Line->new({ borrowernumber => $patron->id, amountoutstanding => 0 })->store; |
222 |
|
223 |
my $lines = $account->lines; |
224 |
is( $lines->_resultset->count, 10, "All accountlines (debits, credits and paid off) were fetched"); |
225 |
|
226 |
$schema->storage->txn_rollback; |
227 |
}; |