|
Lines 516-523
subtest 'search_patrons_to_anonymise & anonymise_issue_history' => sub {
Link Here
|
| 516 |
Koha::Patrons->find( $userenv_patron->{borrowernumber})->delete; |
516 |
Koha::Patrons->find( $userenv_patron->{borrowernumber})->delete; |
| 517 |
}; |
517 |
}; |
| 518 |
|
518 |
|
| 519 |
subtest 'get_overdues' => sub { |
519 |
subtest 'get_issues + get_overdues' => sub { |
| 520 |
plan tests => 4; |
520 |
plan tests => 8; |
| 521 |
|
521 |
|
| 522 |
my $library = $builder->build( { source => 'Branch' } ); |
522 |
my $library = $builder->build( { source => 'Branch' } ); |
| 523 |
my ($biblionumber_1) = AddBiblio( MARC::Record->new, '' ); |
523 |
my ($biblionumber_1) = AddBiblio( MARC::Record->new, '' ); |
|
Lines 559-566
subtest 'get_overdues' => sub {
Link Here
|
| 559 |
} |
559 |
} |
| 560 |
); |
560 |
); |
| 561 |
|
561 |
|
|
|
562 |
$patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
| 563 |
my $issues = $patron->get_issues; |
| 564 |
is( $issues->count, 0, 'get_issues should not return any issues for that patron' ); |
| 565 |
is( ref($issues), 'Koha::Issues', 'get_issues should return a Koha::Issues object' ); |
| 566 |
|
| 562 |
# Not sure how this is useful, but AddIssue pass this variable to different other subroutines |
567 |
# Not sure how this is useful, but AddIssue pass this variable to different other subroutines |
| 563 |
$patron = GetMember( borrowernumber => $patron->{borrowernumber} ); |
568 |
$patron = GetMember( borrowernumber => $patron->borrowernumber ); |
| 564 |
|
569 |
|
| 565 |
my $module = new Test::MockModule('C4::Context'); |
570 |
my $module = new Test::MockModule('C4::Context'); |
| 566 |
$module->mock( 'userenv', sub { { branch => $library->{branchcode} } } ); |
571 |
$module->mock( 'userenv', sub { { branch => $library->{branchcode} } } ); |
|
Lines 570-575
subtest 'get_overdues' => sub {
Link Here
|
| 570 |
AddIssue( $patron, $item_3->{barcode} ); |
575 |
AddIssue( $patron, $item_3->{barcode} ); |
| 571 |
|
576 |
|
| 572 |
$patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
577 |
$patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
|
|
578 |
$issues = $patron->get_issues; |
| 579 |
is( $issues->count, 3, 'get_issues should return 3 issues for that patron' ); |
| 580 |
is( ref($issues), 'Koha::Issues', 'get_issues should return a Koha::Issues object' ); |
| 581 |
|
| 573 |
my $overdues = $patron->get_overdues; |
582 |
my $overdues = $patron->get_overdues; |
| 574 |
is( $overdues->count, 2, 'Patron should have 2 overdues'); |
583 |
is( $overdues->count, 2, 'Patron should have 2 overdues'); |
| 575 |
is( ref($overdues), 'Koha::Issues', 'Koha::Patron->get_overdues should return Koha::Issues' ); |
584 |
is( ref($overdues), 'Koha::Issues', 'Koha::Patron->get_overdues should return Koha::Issues' ); |
| 576 |
- |
|
|