|
Lines 18-24
Link Here
|
| 18 |
|
18 |
|
| 19 |
use Modern::Perl; |
19 |
use Modern::Perl; |
| 20 |
|
20 |
|
| 21 |
use Test::More tests => 19; |
21 |
use Test::More tests => 20; |
| 22 |
use Test::MockModule; |
22 |
use Test::MockModule; |
| 23 |
use Test::Warn; |
23 |
use Test::Warn; |
| 24 |
|
24 |
|
|
Lines 356-359
subtest "makepartialpayment() tests" => sub {
Link Here
|
| 356 |
} |
356 |
} |
| 357 |
}; |
357 |
}; |
| 358 |
|
358 |
|
|
|
359 |
subtest 'get_balance' => sub { |
| 360 |
plan tests => 2; |
| 361 |
|
| 362 |
my $patron = $builder->build({source => 'Borrower'}); |
| 363 |
$patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
| 364 |
my $account_lines = $patron->get_account_lines; |
| 365 |
is( $account_lines->get_balance, 0, 'get_balance should return 0 if the patron does not have fines' ); |
| 366 |
|
| 367 |
my $accountline_1 = $builder->build( |
| 368 |
{ |
| 369 |
source => 'Accountline', |
| 370 |
value => { |
| 371 |
borrowernumber => $patron->borrowernumber, |
| 372 |
amount => 42, |
| 373 |
amountoutstanding => 42 |
| 374 |
} |
| 375 |
} |
| 376 |
); |
| 377 |
my $accountline_2 = $builder->build( |
| 378 |
{ |
| 379 |
source => 'Accountline', |
| 380 |
value => { |
| 381 |
borrowernumber => $patron->borrowernumber, |
| 382 |
amount => -13, |
| 383 |
amountoutstanding => -13 |
| 384 |
} |
| 385 |
} |
| 386 |
); |
| 387 |
|
| 388 |
my $balance = $patron->get_account_lines->get_balance; |
| 389 |
is( int($balance), 29, 'get_balance should return the correct value'); |
| 390 |
|
| 391 |
$patron->delete; |
| 392 |
}; |
| 393 |
|
| 359 |
1; |
394 |
1; |
| 360 |
- |
|
|