Bug 32650: Prevent Koha/Holds.t to fail randomly

22:25:51 koha_1       |     #   Failed test 'Items 1, 2, and 5 are available for filling the holds'
22:25:51 koha_1       |     #   at t/db_dependent/Koha/Holds.t line 531.
22:25:51 koha_1       |     #     Structures begin differing at:
22:25:51 koha_1       |     #          $got->[0] = '1000'
22:25:51 koha_1       |     #     $expected->[0] = '996'
22:25:51 koha_1       |     # Looks like you failed 1 test of 6.
22:25:51 koha_1       |
22:25:51 koha_1       | #   Failed test 'get_items_that_can_fill'
22:25:51 koha_1       | #   at t/db_dependent/Koha/Holds.t line 539.

We need to use a numeric sort, or 1000 is before 996...

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 9d950959bf)
Signed-off-by: Jacob O'Mara <jacob.omara@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2023-01-18 15:45:34 +01:00 committed by Jacob O'Mara
parent eb2fbe6dd6
commit d28f98e5ed

View file

@ -529,7 +529,7 @@ subtest 'get_items_that_can_fill' => sub {
}
);
$items = $holds->get_items_that_can_fill;
is_deeply( [ sort map { $_->itemnumber } $items->as_list ],
is_deeply( [ sort { $a <=> $b } map { $_->itemnumber } $items->as_list ],
[ $item_1->itemnumber, $item_2->itemnumber, $item_5->itemnumber ], 'Items 1, 2, and 5 are available for filling the holds' );
my $no_holds = Koha::Holds->new->empty();