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 => 15; |
23 |
use Test::Warn; |
23 |
use Test::Warn; |
24 |
use DateTime; |
24 |
use DateTime; |
25 |
|
25 |
|
Lines 406-413
subtest 'add_enrolment_fee_if_needed' => sub {
Link Here
|
406 |
$patron->delete; |
406 |
$patron->delete; |
407 |
}; |
407 |
}; |
408 |
|
408 |
|
409 |
subtest 'get_overdues' => sub { |
409 |
subtest 'get_issues + get_overdues' => sub { |
410 |
plan tests => 4; |
410 |
plan tests => 8; |
411 |
|
411 |
|
412 |
my $library = $builder->build( { source => 'Branch' } ); |
412 |
my $library = $builder->build( { source => 'Branch' } ); |
413 |
my ($biblionumber_1) = AddBiblio( MARC::Record->new, '' ); |
413 |
my ($biblionumber_1) = AddBiblio( MARC::Record->new, '' ); |
Lines 449-456
subtest 'get_overdues' => sub {
Link Here
|
449 |
} |
449 |
} |
450 |
); |
450 |
); |
451 |
|
451 |
|
|
|
452 |
$patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
453 |
my $issues = $patron->get_issues; |
454 |
is( $issues->count, 0, 'get_issues should not return any issues for that patron' ); |
455 |
is( ref($issues), 'Koha::Issues', 'get_issues should return a Koha::Issues object' ); |
456 |
|
452 |
# Not sure how this is useful, but AddIssue pass this variable to different other subroutines |
457 |
# Not sure how this is useful, but AddIssue pass this variable to different other subroutines |
453 |
$patron = GetMember( borrowernumber => $patron->{borrowernumber} ); |
458 |
$patron = GetMember( borrowernumber => $patron->borrowernumber ); |
454 |
|
459 |
|
455 |
my $module = new Test::MockModule('C4::Context'); |
460 |
my $module = new Test::MockModule('C4::Context'); |
456 |
$module->mock( 'userenv', sub { { branch => $library->{branchcode} } } ); |
461 |
$module->mock( 'userenv', sub { { branch => $library->{branchcode} } } ); |
Lines 460-465
subtest 'get_overdues' => sub {
Link Here
|
460 |
AddIssue( $patron, $item_3->{barcode} ); |
465 |
AddIssue( $patron, $item_3->{barcode} ); |
461 |
|
466 |
|
462 |
$patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
467 |
$patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
|
|
468 |
$issues = $patron->get_issues; |
469 |
is( $issues->count, 3, 'get_issues should return 3 issues for that patron' ); |
470 |
is( ref($issues), 'Koha::Issues', 'get_issues should return a Koha::Issues object' ); |
471 |
|
463 |
my $overdues = $patron->get_overdues; |
472 |
my $overdues = $patron->get_overdues; |
464 |
is( $overdues->count, 2, 'Patron should have 2 overdues'); |
473 |
is( $overdues->count, 2, 'Patron should have 2 overdues'); |
465 |
is( ref($overdues), 'Koha::Issues', 'Koha::Patron->get_overdues should return Koha::Issues' ); |
474 |
is( ref($overdues), 'Koha::Issues', 'Koha::Patron->get_overdues should return Koha::Issues' ); |
466 |
- |
|
|