|
Lines 26-31
use Koha::Account;
Link Here
|
| 26 |
use Koha::Account::Lines; |
26 |
use Koha::Account::Lines; |
| 27 |
use Koha::Account::Offsets; |
27 |
use Koha::Account::Offsets; |
| 28 |
|
28 |
|
|
|
29 |
|
| 29 |
use t::lib::Mocks; |
30 |
use t::lib::Mocks; |
| 30 |
use t::lib::TestBuilder; |
31 |
use t::lib::TestBuilder; |
| 31 |
|
32 |
|
|
Lines 61-67
subtest 'outstanding_debits() tests' => sub {
Link Here
|
| 61 |
is( ref($lines_arr[$i]), 'Koha::Account::Line', 'outstanding_debits returns a list of Koha::Account::Line objects in list context' ); |
62 |
is( ref($lines_arr[$i]), 'Koha::Account::Line', 'outstanding_debits returns a list of Koha::Account::Line objects in list context' ); |
| 62 |
$i++; |
63 |
$i++; |
| 63 |
} |
64 |
} |
| 64 |
|
|
|
| 65 |
my $patron_2 = $builder->build_object({ class => 'Koha::Patrons' }); |
65 |
my $patron_2 = $builder->build_object({ class => 'Koha::Patrons' }); |
| 66 |
Koha::Account::Line->new({ borrowernumber => $patron_2->id, amountoutstanding => -2 })->store; |
66 |
Koha::Account::Line->new({ borrowernumber => $patron_2->id, amountoutstanding => -2 })->store; |
| 67 |
my $just_one = Koha::Account::Line->new({ borrowernumber => $patron_2->id, amount => 3, amountoutstanding => 3 })->store; |
67 |
my $just_one = Koha::Account::Line->new({ borrowernumber => $patron_2->id, amount => 3, amountoutstanding => 3 })->store; |
|
Lines 140-146
subtest 'outstanding_credits() tests' => sub {
Link Here
|
| 140 |
|
140 |
|
| 141 |
subtest 'add_credit() tests' => sub { |
141 |
subtest 'add_credit() tests' => sub { |
| 142 |
|
142 |
|
| 143 |
plan tests => 15; |
143 |
plan tests => 16; |
| 144 |
|
144 |
|
| 145 |
$schema->storage->txn_begin; |
145 |
$schema->storage->txn_begin; |
| 146 |
|
146 |
|
|
Lines 150-155
subtest 'add_credit() tests' => sub {
Link Here
|
| 150 |
|
150 |
|
| 151 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
151 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
| 152 |
my $account = Koha::Account->new( { patron_id => $patron->borrowernumber } ); |
152 |
my $account = Koha::Account->new( { patron_id => $patron->borrowernumber } ); |
|
|
153 |
is( defined $account, 1, "Account is defined" ); |
| 153 |
|
154 |
|
| 154 |
is( $account->balance, 0, 'Patron has no balance' ); |
155 |
is( $account->balance, 0, 'Patron has no balance' ); |
| 155 |
|
156 |
|
| 156 |
- |
|
|