|
Lines 19-25
Link Here
|
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 19; |
22 |
use Test::More tests => 20; |
| 23 |
use Test::Warn; |
23 |
use Test::Warn; |
| 24 |
use DateTime; |
24 |
use DateTime; |
| 25 |
|
25 |
|
|
Lines 594-599
subtest 'search_upcoming_membership_expires' => sub {
Link Here
|
| 594 |
Koha::Patrons->search({ borrowernumber => { in => [ $patron_1->{borrowernumber}, $patron_2->{borrowernumber}, $patron_3->{borrowernumber} ] } })->delete; |
594 |
Koha::Patrons->search({ borrowernumber => { in => [ $patron_1->{borrowernumber}, $patron_2->{borrowernumber}, $patron_3->{borrowernumber} ] } })->delete; |
| 595 |
}; |
595 |
}; |
| 596 |
|
596 |
|
|
|
597 |
subtest 'holds' => sub { |
| 598 |
plan tests => 3; |
| 599 |
|
| 600 |
my $library = $builder->build( { source => 'Branch' } ); |
| 601 |
my ($biblionumber_1) = AddBiblio( MARC::Record->new, '' ); |
| 602 |
my $item_1 = $builder->build( |
| 603 |
{ |
| 604 |
source => 'Item', |
| 605 |
value => { |
| 606 |
homebranch => $library->{branchcode}, |
| 607 |
holdingbranch => $library->{branchcode}, |
| 608 |
biblionumber => $biblionumber_1 |
| 609 |
} |
| 610 |
} |
| 611 |
); |
| 612 |
my $item_2 = $builder->build( |
| 613 |
{ |
| 614 |
source => 'Item', |
| 615 |
value => { |
| 616 |
homebranch => $library->{branchcode}, |
| 617 |
holdingbranch => $library->{branchcode}, |
| 618 |
biblionumber => $biblionumber_1 |
| 619 |
} |
| 620 |
} |
| 621 |
); |
| 622 |
my ($biblionumber_2) = AddBiblio( MARC::Record->new, '' ); |
| 623 |
my $item_3 = $builder->build( |
| 624 |
{ |
| 625 |
source => 'Item', |
| 626 |
value => { |
| 627 |
homebranch => $library->{branchcode}, |
| 628 |
holdingbranch => $library->{branchcode}, |
| 629 |
biblionumber => $biblionumber_2 |
| 630 |
} |
| 631 |
} |
| 632 |
); |
| 633 |
my $patron = $builder->build( |
| 634 |
{ |
| 635 |
source => 'Borrower', |
| 636 |
value => { branchcode => $library->{branchcode} } |
| 637 |
} |
| 638 |
); |
| 639 |
|
| 640 |
$patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
| 641 |
my $holds = $patron->holds; |
| 642 |
is( ref($holds), 'Koha::Holds', |
| 643 |
'Koha::Patron->holds should return a Koha::Holds objects' ); |
| 644 |
is( $holds->count, 0, 'There should not be holds placed by this patron yet' ); |
| 645 |
|
| 646 |
C4::Reserves::AddReserve( $library->{branchcode}, |
| 647 |
$patron->borrowernumber, $biblionumber_1 ); |
| 648 |
# In the future |
| 649 |
C4::Reserves::AddReserve( $library->{branchcode}, |
| 650 |
$patron->borrowernumber, $biblionumber_2, undef, undef, dt_from_string->add( days => 2 ) ); |
| 651 |
|
| 652 |
$holds = $patron->holds; |
| 653 |
is( $holds->count, 2, 'There should be 2 holds placed by this patron' ); |
| 654 |
|
| 655 |
$holds->delete; |
| 656 |
$patron->delete; |
| 657 |
}; |
| 658 |
|
| 597 |
$retrieved_patron_1->delete; |
659 |
$retrieved_patron_1->delete; |
| 598 |
is( Koha::Patrons->search->count, $nb_of_patrons + 1, 'Delete should have deleted the patron' ); |
660 |
is( Koha::Patrons->search->count, $nb_of_patrons + 1, 'Delete should have deleted the patron' ); |
| 599 |
|
661 |
|
| 600 |
- |
|
|