|
Lines 430-437
subtest 'add_enrolment_fee_if_needed' => sub {
Link Here
|
| 430 |
$patron->delete; |
430 |
$patron->delete; |
| 431 |
}; |
431 |
}; |
| 432 |
|
432 |
|
| 433 |
subtest 'checkouts + get_overdues' => sub { |
433 |
subtest 'checkouts + get_overdues + old_checkouts' => sub { |
| 434 |
plan tests => 8; |
434 |
plan tests => 12; |
| 435 |
|
435 |
|
| 436 |
my $library = $builder->build( { source => 'Branch' } ); |
436 |
my $library = $builder->build( { source => 'Branch' } ); |
| 437 |
my ($biblionumber_1) = AddBiblio( MARC::Record->new, '' ); |
437 |
my ($biblionumber_1) = AddBiblio( MARC::Record->new, '' ); |
|
Lines 441-447
subtest 'checkouts + get_overdues' => sub {
Link Here
|
| 441 |
value => { |
441 |
value => { |
| 442 |
homebranch => $library->{branchcode}, |
442 |
homebranch => $library->{branchcode}, |
| 443 |
holdingbranch => $library->{branchcode}, |
443 |
holdingbranch => $library->{branchcode}, |
| 444 |
biblionumber => $biblionumber_1 |
444 |
biblionumber => $biblionumber_1, |
|
|
445 |
itemlost => 0, |
| 446 |
withdrawn => 0, |
| 445 |
} |
447 |
} |
| 446 |
} |
448 |
} |
| 447 |
); |
449 |
); |
|
Lines 451-457
subtest 'checkouts + get_overdues' => sub {
Link Here
|
| 451 |
value => { |
453 |
value => { |
| 452 |
homebranch => $library->{branchcode}, |
454 |
homebranch => $library->{branchcode}, |
| 453 |
holdingbranch => $library->{branchcode}, |
455 |
holdingbranch => $library->{branchcode}, |
| 454 |
biblionumber => $biblionumber_1 |
456 |
biblionumber => $biblionumber_1, |
|
|
457 |
itemlost => 0, |
| 458 |
withdrawn => 0, |
| 455 |
} |
459 |
} |
| 456 |
} |
460 |
} |
| 457 |
); |
461 |
); |
|
Lines 462-468
subtest 'checkouts + get_overdues' => sub {
Link Here
|
| 462 |
value => { |
466 |
value => { |
| 463 |
homebranch => $library->{branchcode}, |
467 |
homebranch => $library->{branchcode}, |
| 464 |
holdingbranch => $library->{branchcode}, |
468 |
holdingbranch => $library->{branchcode}, |
| 465 |
biblionumber => $biblionumber_2 |
469 |
biblionumber => $biblionumber_2, |
|
|
470 |
itemlost => 0, |
| 471 |
withdrawn => 0, |
| 466 |
} |
472 |
} |
| 467 |
} |
473 |
} |
| 468 |
); |
474 |
); |
|
Lines 477-482
subtest 'checkouts + get_overdues' => sub {
Link Here
|
| 477 |
my $checkouts = $patron->checkouts; |
483 |
my $checkouts = $patron->checkouts; |
| 478 |
is( $checkouts->count, 0, 'checkouts should not return any issues for that patron' ); |
484 |
is( $checkouts->count, 0, 'checkouts should not return any issues for that patron' ); |
| 479 |
is( ref($checkouts), 'Koha::Checkouts', 'checkouts should return a Koha::Checkouts object' ); |
485 |
is( ref($checkouts), 'Koha::Checkouts', 'checkouts should return a Koha::Checkouts object' ); |
|
|
486 |
my $old_checkouts = $patron->old_checkouts; |
| 487 |
is( $old_checkouts->count, 0, 'old_checkouts should not return any issues for that patron' ); |
| 488 |
is( ref($old_checkouts), 'Koha::Old::Checkouts', 'old_checkouts should return a Koha::Old::Checkouts object' ); |
| 480 |
|
489 |
|
| 481 |
# Not sure how this is useful, but AddIssue pass this variable to different other subroutines |
490 |
# Not sure how this is useful, but AddIssue pass this variable to different other subroutines |
| 482 |
$patron = Koha::Patrons->find( $patron->borrowernumber )->unblessed; |
491 |
$patron = Koha::Patrons->find( $patron->borrowernumber )->unblessed; |
|
Lines 499-504
subtest 'checkouts + get_overdues' => sub {
Link Here
|
| 499 |
is( $overdues->next->itemnumber, $item_1->{itemnumber}, 'The issue should be returned in the same order as they have been done, first is correct' ); |
508 |
is( $overdues->next->itemnumber, $item_1->{itemnumber}, 'The issue should be returned in the same order as they have been done, first is correct' ); |
| 500 |
is( $overdues->next->itemnumber, $item_2->{itemnumber}, 'The issue should be returned in the same order as they have been done, second is correct' ); |
509 |
is( $overdues->next->itemnumber, $item_2->{itemnumber}, 'The issue should be returned in the same order as they have been done, second is correct' ); |
| 501 |
|
510 |
|
|
|
511 |
|
| 512 |
C4::Circulation::AddReturn( $item_1->{barcode} ); |
| 513 |
C4::Circulation::AddReturn( $item_2->{barcode} ); |
| 514 |
$old_checkouts = $patron->old_checkouts; |
| 515 |
is( $old_checkouts->count, 2, 'old_checkouts should return 2 old checkouts that patron' ); |
| 516 |
is( ref($old_checkouts), 'Koha::Old::Checkouts', 'old_checkouts should return a Koha::Old::Checkouts object' ); |
| 517 |
|
| 502 |
# Clean stuffs |
518 |
# Clean stuffs |
| 503 |
Koha::Checkouts->search( { borrowernumber => $patron->borrowernumber } )->delete; |
519 |
Koha::Checkouts->search( { borrowernumber => $patron->borrowernumber } )->delete; |
| 504 |
$patron->delete; |
520 |
$patron->delete; |
| 505 |
- |
|
|