Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 10; |
22 |
use Test::More tests => 11; |
23 |
use Test::Warn; |
23 |
use Test::Warn; |
24 |
|
24 |
|
25 |
use C4::Circulation qw( AddIssue ); |
25 |
use C4::Circulation qw( AddIssue ); |
Lines 670-675
subtest 'Test Koha::Hold::item_group' => sub {
Link Here
|
670 |
|
670 |
|
671 |
$schema->storage->txn_rollback; |
671 |
$schema->storage->txn_rollback; |
672 |
|
672 |
|
|
|
673 |
subtest 'filter_by_found() tests' => sub { |
674 |
|
675 |
plan tests => 5; |
676 |
|
677 |
$schema->storage->txn_begin; |
678 |
|
679 |
my $unfilled = $builder->build_object( { class => 'Koha::Holds', value => { found => undef } } ); |
680 |
my $processing = $builder->build_object( { class => 'Koha::Holds', value => { found => 'P' } } ); |
681 |
my $in_transit = $builder->build_object( { class => 'Koha::Holds', value => { found => 'T' } } ); |
682 |
my $waiting = $builder->build_object( { class => 'Koha::Holds', value => { found => 'W' } } ); |
683 |
|
684 |
my $holds = Koha::Holds->search( |
685 |
{ reserve_id => [ $unfilled->id, $processing->id, $in_transit->id, $waiting->id ] }, |
686 |
{ order_by => ['reserve_id'] } |
687 |
); |
688 |
|
689 |
is( $holds->count, 4, 'Resultset count is correct' ); |
690 |
|
691 |
my $found_holds = $holds->filter_by_found; |
692 |
|
693 |
is( $found_holds->count, 3, 'Resultset count is correct' ); |
694 |
|
695 |
ok( $found_holds->next->is_in_processing, 'Status is correct (P)' ); |
696 |
ok( $found_holds->next->is_in_transit, 'Status is correct (T)' ); |
697 |
ok( $found_holds->next->is_waiting, 'Status is correct (W)' ); |
698 |
|
699 |
|
700 |
$schema->storage->txn_rollback; |
701 |
}; |
702 |
|
673 |
subtest 'filter_by_has_cancellation_requests() and filter_out_has_cancellation_requests() tests' => sub { |
703 |
subtest 'filter_by_has_cancellation_requests() and filter_out_has_cancellation_requests() tests' => sub { |
674 |
|
704 |
|
675 |
plan tests => 7; |
705 |
plan tests => 7; |
676 |
- |
|
|