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