Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 8; |
22 |
use Test::More tests => 9; |
23 |
use Test::Warn; |
23 |
use Test::Warn; |
24 |
|
24 |
|
25 |
use C4::Circulation qw( AddIssue ); |
25 |
use C4::Circulation qw( AddIssue ); |
Lines 641-646
subtest 'set_waiting+patron_expiration_date' => sub {
Link Here
|
641 |
}; |
641 |
}; |
642 |
}; |
642 |
}; |
643 |
|
643 |
|
|
|
644 |
subtest 'count_grouped' => sub { |
645 |
plan tests => 3; |
646 |
$schema->storage->txn_begin; |
647 |
|
648 |
my $patron = $builder->build_object({ |
649 |
class => 'Koha::Patrons', |
650 |
}); |
651 |
my $patron_id = $patron->borrowernumber; |
652 |
|
653 |
my $hold1 = $builder->build_object({ |
654 |
class => 'Koha::Holds', |
655 |
value => { |
656 |
borrowernumber => $patron_id, |
657 |
hold_group_id => undef, |
658 |
}, |
659 |
}); |
660 |
|
661 |
is($patron->holds->count_grouped, 1, 'Test patron has 1 hold.'); |
662 |
|
663 |
my $hold_group = $builder->build_object({ |
664 |
class => 'Koha::HoldGroups', |
665 |
}); |
666 |
|
667 |
my $hold2 = $builder->build_object({ |
668 |
class => 'Koha::Holds', |
669 |
value => { |
670 |
borrowernumber => $patron_id, |
671 |
hold_group_id => $hold_group->hold_group_id, |
672 |
} |
673 |
}); |
674 |
my $hold3 = $builder->build_object({ |
675 |
class => 'Koha::Holds', |
676 |
value => { |
677 |
borrowernumber => $patron_id, |
678 |
hold_group_id => $hold_group->hold_group_id, |
679 |
} |
680 |
}); |
681 |
|
682 |
is($patron->holds->count_grouped, 2, 'Test patron has 2 holds.'); |
683 |
|
684 |
my $hold_group2 = $builder->build_object({ |
685 |
class => 'Koha::HoldGroups', |
686 |
}); |
687 |
|
688 |
my $hold4 = $builder->build_object({ |
689 |
class => 'Koha::Holds', |
690 |
value => { |
691 |
borrowernumber => $patron_id, |
692 |
hold_group_id => $hold_group2->hold_group_id, |
693 |
} |
694 |
}); |
695 |
my $hold5 = $builder->build_object({ |
696 |
class => 'Koha::Holds', |
697 |
value => { |
698 |
borrowernumber => $patron_id, |
699 |
hold_group_id => $hold_group2->hold_group_id, |
700 |
} |
701 |
}); |
702 |
my $hold6 = $builder->build_object({ |
703 |
class => 'Koha::Holds', |
704 |
value => { |
705 |
borrowernumber => $patron_id, |
706 |
hold_group_id => $hold_group2->hold_group_id, |
707 |
} |
708 |
}); |
709 |
|
710 |
is($patron->holds->count_grouped, 3, 'Test patron has 3 holds.'); |
711 |
|
712 |
$schema->storage->txn_rollback; |
713 |
}; |
644 |
|
714 |
|
645 |
$schema->storage->txn_rollback; |
715 |
$schema->storage->txn_rollback; |
646 |
|
716 |
|