View | Details | Raw Unified | Return to bug 18958
Collapse All | Expand All

(-)a/t/db_dependent/Reserves.t (-2 / +66 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 62;
20
use Test::More tests => 63;
21
use Test::MockModule;
21
use Test::MockModule;
22
use Test::Warn;
22
use Test::Warn;
23
23
Lines 835-840 subtest 'MoveReserve additional test' => sub { Link Here
835
835
836
};
836
};
837
837
838
subtest 'CheckReserves additional test' => sub {
839
840
    plan tests => 3;
841
842
    my $biblio = $builder->build_sample_biblio();
843
    my $itype = $builder->build_object({ class => "Koha::ItemTypes", value => { notforloan => 0 } });
844
    my $item_1 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber,notforloan => 0, itype => $itype->itemtype });
845
    my $reserve1 = $builder->build_object({
846
        class => "Koha::Holds",
847
        value => {
848
            found => undef,
849
            priority => 1,
850
            itemnumber => undef,
851
            biblionumber => $biblio->biblionumber,
852
            waitingdate => undef,
853
            cancellationdate => undef,
854
            item_level_hold => 0,
855
            lowestPriority => 0,
856
            expirationdate => undef,
857
            suspend_until => undef,
858
            suspend => 0,
859
            itemtype => undef,
860
        }
861
    });
862
    my $reserve2 = $builder->build_object({
863
        class => "Koha::Holds",
864
        value => {
865
            found => undef,
866
            priority => 2,
867
            biblionumber => $biblio->biblionumber,
868
            borrowernumber => $reserve1->borrowernumber,
869
            itemnumber => undef,
870
            waitingdate => undef,
871
            cancellationdate => undef,
872
            item_level_hold => 0,
873
            lowestPriority => 0,
874
            expirationdate => undef,
875
            suspend_until => undef,
876
            suspend => 0,
877
            itemtype => undef,
878
        }
879
    });
880
881
    my $tmp_holdsqueue = $builder->build({source=>'TmpHoldsqueue',value=>{
882
            borrowernumber => $reserve1->borrowernumber,
883
            biblionumber   => $reserve1->biblionumber,
884
        }
885
    });
886
    my $fill_target = $builder->build({source=>'HoldFillTarget',value=>{
887
            borrowernumber => $reserve1->borrowernumber,
888
            biblionumber   => $reserve1->biblionumber,
889
            itemnumber   => $item_1->itemnumber,
890
            item_level_request => 0,
891
        }
892
    });
893
894
     ModReserveAffect( $item_1->itemnumber, $reserve1->borrowernumber, 1, $reserve1->reserve_id );
895
     my ($status, $matched_reserve, $possible_reserves) = CheckReserves($item_1->itemnumber);
896
897
     is( $status, 'Reserved', "We found a reserve" );
898
     is( $matched_reserve->{reserve_id}, $reserve1->reserve_id, "We got the Transit reserve");
899
     is( scalar @$possible_reserves, 1, 'We only get the one matched');
900
901
};
902
838
sub count_hold_print_messages {
903
sub count_hold_print_messages {
839
    my $message_count = $dbh->selectall_arrayref(q{
904
    my $message_count = $dbh->selectall_arrayref(q{
840
        SELECT COUNT(*)
905
        SELECT COUNT(*)
841
- 

Return to bug 18958