|
Lines 19-25
Link Here
|
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 14; |
22 |
use Test::More tests => 16; |
| 23 |
use Test::Warn; |
23 |
use Test::Warn; |
| 24 |
use DateTime; |
24 |
use DateTime; |
| 25 |
|
25 |
|
|
Lines 471-476
subtest 'get_overdues' => sub {
Link Here
|
| 471 |
$patron->delete; |
471 |
$patron->delete; |
| 472 |
}; |
472 |
}; |
| 473 |
|
473 |
|
|
|
474 |
subtest 'get_account_lines' => sub { |
| 475 |
plan tests => 2; |
| 476 |
|
| 477 |
my $patron = $builder->build({source => 'Borrower'}); |
| 478 |
|
| 479 |
my $accountline_1 = $builder->build({ source => 'Accountline', |
| 480 |
value => { borrowernumber => $patron->{borrowernumber}, |
| 481 |
amount => 42, |
| 482 |
amountoutstanding => 42 } |
| 483 |
}); |
| 484 |
my $accountline_2 = $builder->build({ source => 'Accountline', |
| 485 |
value => { borrowernumber => $patron->{borrowernumber}, |
| 486 |
amount => -13, |
| 487 |
amountoutstanding => -13 } |
| 488 |
}); |
| 489 |
|
| 490 |
$patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
| 491 |
my $account_lines = $patron->get_account_lines; |
| 492 |
is( $account_lines->count, 2, 'There should have 2 account lines for that patron' ); |
| 493 |
is( ref($account_lines), 'Koha::Account::Lines', 'get_account_lines should return a Koha::Account::Lines object' ); |
| 494 |
|
| 495 |
$patron->delete; |
| 496 |
}; |
| 497 |
|
| 474 |
$retrieved_patron_1->delete; |
498 |
$retrieved_patron_1->delete; |
| 475 |
is( Koha::Patrons->search->count, $nb_of_patrons + 1, 'Delete should have deleted the patron' ); |
499 |
is( Koha::Patrons->search->count, $nb_of_patrons + 1, 'Delete should have deleted the patron' ); |
| 476 |
|
500 |
|
| 477 |
- |
|
|