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

(-)a/t/db_dependent/Reserves.t (-2 / +43 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 1045-1050 subtest 'MoveReserve additional test' => sub { Link Here
1045
1045
1046
};
1046
};
1047
1047
1048
subtest 'RevertWaitingStatus' => sub {
1049
1050
    plan tests => 2;
1051
1052
    # Create the items and patrons we need
1053
    my $biblio  = $builder->build_sample_biblio();
1054
    my $library = $builder->build_object( { class => 'Koha::Libraries' } );
1055
    my $itype   = $builder->build_object(
1056
        { class => "Koha::ItemTypes", value => { notforloan => 0 } } );
1057
    my $item_1 = $builder->build_sample_item(
1058
        {
1059
            biblionumber => $biblio->biblionumber,
1060
            itype        => $itype->itemtype,
1061
            library      => $library->branchcode
1062
        }
1063
    );
1064
    my $patron_1 = $builder->build_object( { class => "Koha::Patrons" } );
1065
    my $patron_2 = $builder->build_object( { class => "Koha::Patrons" } );
1066
    my $patron_3 = $builder->build_object( { class => "Koha::Patrons" } );
1067
    my $patron_4 = $builder->build_object( { class => "Koha::Patrons" } );
1068
1069
    # Place a hold on the title for both patrons
1070
    my $hold_1 = place_item_hold( $patron_1, $item_1, $library, $priority );
1071
    my $hold_2 = place_item_hold( $patron_2, $item_1, $library, $priority );
1072
    my $hold_3 = place_item_hold( $patron_3, $item_1, $library, $priority );
1073
    my $hold_4 = place_item_hold( $patron_4, $item_1, $library, $priority );
1074
1075
    $hold_1->set_waiting;
1076
    AddIssue( $patron_3->unblessed, $item_1->barcode, undef, 'revert' );
1077
1078
    my $holds = $biblio->holds;
1079
    is( $holds->count, 3, 'One hold has been deleted' );
1080
    is_deeply(
1081
        [
1082
            $holds->next->priority, $holds->next->priority,
1083
            $holds->next->priority
1084
        ],
1085
        [ 1, 2, 3 ],
1086
        'priorities have been reordered'
1087
    );
1088
};
1089
1048
sub count_hold_print_messages {
1090
sub count_hold_print_messages {
1049
    my $message_count = $dbh->selectall_arrayref(q{
1091
    my $message_count = $dbh->selectall_arrayref(q{
1050
        SELECT COUNT(*)
1092
        SELECT COUNT(*)
1051
- 

Return to bug 23070