Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 9; |
22 |
use Test::More tests => 10; |
23 |
use Test::Warn; |
23 |
use Test::Warn; |
24 |
|
24 |
|
25 |
use C4::Circulation qw( AddIssue ); |
25 |
use C4::Circulation qw( AddIssue ); |
Lines 745-796
subtest 'filter_by_has_cancellation_requests() and filter_out_has_cancellation_r
Link Here
|
745 |
$schema->storage->txn_rollback; |
745 |
$schema->storage->txn_rollback; |
746 |
}; |
746 |
}; |
747 |
|
747 |
|
748 |
subtest 'get holds in processing' => sub { |
748 |
subtest 'processing() tests' => sub { |
749 |
|
749 |
|
750 |
plan tests => 1; |
750 |
plan tests => 3; |
751 |
|
751 |
|
752 |
$schema->storage->txn_begin; |
752 |
$schema->storage->txn_begin; |
753 |
|
753 |
|
754 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
|
|
755 |
|
756 |
my $item = $builder->build_sample_item; |
757 |
|
758 |
my $hold_1 = $builder->build_object( |
754 |
my $hold_1 = $builder->build_object( |
759 |
{ |
755 |
{ |
760 |
class => 'Koha::Holds', |
756 |
class => 'Koha::Holds', |
761 |
value => { |
757 |
value => { found => 'P' } |
762 |
found => 'P', |
|
|
763 |
itemnumber => $item->id, |
764 |
biblionumber => $item->biblionumber, |
765 |
borrowernumber => $patron->id |
766 |
} |
767 |
} |
758 |
} |
768 |
); |
759 |
); |
769 |
my $hold_2 = $builder->build_object( |
760 |
my $hold_2 = $builder->build_object( |
770 |
{ |
761 |
{ |
771 |
class => 'Koha::Holds', |
762 |
class => 'Koha::Holds', |
772 |
value => { |
763 |
value => { found => undef } |
773 |
found => undef, |
|
|
774 |
itemnumber => $item->id, |
775 |
biblionumber => $item->biblionumber, |
776 |
borrowernumber => $patron->id |
777 |
} |
778 |
} |
764 |
} |
779 |
); |
765 |
); |
780 |
my $hold_3 = $builder->build_object( |
766 |
my $hold_3 = $builder->build_object( |
781 |
{ |
767 |
{ |
782 |
class => 'Koha::Holds', |
768 |
class => 'Koha::Holds', |
783 |
value => { |
769 |
value => { found => 'T' } |
784 |
found => undef, |
|
|
785 |
itemnumber => $item->id, |
786 |
biblionumber => $item->biblionumber, |
787 |
borrowernumber => $patron->id |
788 |
} |
789 |
} |
770 |
} |
790 |
); |
771 |
); |
791 |
|
772 |
|
792 |
my $processing_holds = $item->holds->processing; |
773 |
my $holds = Koha::Holds->search({ reserve_id => [ $hold_1->id, $hold_2->id, $hold_3->id ] }); |
793 |
is( $processing_holds->count, 1 ); |
774 |
is( $holds->count, 3, 'Resultset contains 3 holds' ); |
|
|
775 |
|
776 |
my $processing = $holds->processing; |
777 |
is( $processing->count, 1 ); |
778 |
is( $processing->next->id, $hold_1->id, "First hold is the only one in 'processing'" ); |
794 |
|
779 |
|
795 |
$schema->storage->txn_rollback; |
780 |
$schema->storage->txn_rollback; |
796 |
}; |
781 |
}; |
797 |
- |
|
|