Lines 412-419
subtest 'add_enrolment_fee_if_needed' => sub {
Link Here
|
412 |
$patron->delete; |
412 |
$patron->delete; |
413 |
}; |
413 |
}; |
414 |
|
414 |
|
415 |
subtest 'get_overdues' => sub { |
415 |
subtest 'get_checkouts + get_overdues' => sub { |
416 |
plan tests => 4; |
416 |
plan tests => 8; |
417 |
|
417 |
|
418 |
my $library = $builder->build( { source => 'Branch' } ); |
418 |
my $library = $builder->build( { source => 'Branch' } ); |
419 |
my ($biblionumber_1) = AddBiblio( MARC::Record->new, '' ); |
419 |
my ($biblionumber_1) = AddBiblio( MARC::Record->new, '' ); |
Lines 455-462
subtest 'get_overdues' => sub {
Link Here
|
455 |
} |
455 |
} |
456 |
); |
456 |
); |
457 |
|
457 |
|
|
|
458 |
$patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
459 |
my $checkouts = $patron->get_checkouts; |
460 |
is( $checkouts->count, 0, 'get_checkouts should not return any issues for that patron' ); |
461 |
is( ref($checkouts), 'Koha::Checkouts', 'get_checkouts should return a Koha::Checkouts object' ); |
462 |
|
458 |
# Not sure how this is useful, but AddIssue pass this variable to different other subroutines |
463 |
# Not sure how this is useful, but AddIssue pass this variable to different other subroutines |
459 |
$patron = GetMember( borrowernumber => $patron->{borrowernumber} ); |
464 |
$patron = GetMember( borrowernumber => $patron->borrowernumber ); |
460 |
|
465 |
|
461 |
my $module = new Test::MockModule('C4::Context'); |
466 |
my $module = new Test::MockModule('C4::Context'); |
462 |
$module->mock( 'userenv', sub { { branch => $library->{branchcode} } } ); |
467 |
$module->mock( 'userenv', sub { { branch => $library->{branchcode} } } ); |
Lines 466-471
subtest 'get_overdues' => sub {
Link Here
|
466 |
AddIssue( $patron, $item_3->{barcode} ); |
471 |
AddIssue( $patron, $item_3->{barcode} ); |
467 |
|
472 |
|
468 |
$patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
473 |
$patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
|
|
474 |
$checkouts = $patron->get_checkouts; |
475 |
is( $checkouts->count, 3, 'get_checkouts should return 3 issues for that patron' ); |
476 |
is( ref($checkouts), 'Koha::Checkouts', 'get_checkouts should return a Koha::Checkouts object' ); |
477 |
|
469 |
my $overdues = $patron->get_overdues; |
478 |
my $overdues = $patron->get_overdues; |
470 |
is( $overdues->count, 2, 'Patron should have 2 overdues'); |
479 |
is( $overdues->count, 2, 'Patron should have 2 overdues'); |
471 |
is( ref($overdues), 'Koha::Checkouts', 'Koha::Patron->get_overdues should return Koha::Checkouts' ); |
480 |
is( ref($overdues), 'Koha::Checkouts', 'Koha::Patron->get_overdues should return Koha::Checkouts' ); |
472 |
- |
|
|