Browse Source

Bug 28445: (follow-up) Add diag for failing test

Last diag was not enough (Koha_Master_D11/457)

         #   Failed test 'Item types should be sorted by description and an empty entries should be shown'
         #   at t/db_dependent/Koha/UI/Form/Builder/Item.t line 127.
         #     Structures begin differing at:
         #          $got->[11] = 'X_vvQE5'
         #     $expected->[11] = 'knHm32'
         # Itemtypes details: $VAR1 = [
         #           '',
         #           'EMVzKcGR',
         #           'x4S8_BaFCp',
         #           'Cp2BGkY',
         #           'BK',
         #           'CF',
         #           'CR',
         #           'bBvgmVAIzD',
         #           'WKyaQ_l',
         #           'Cjc0SKQz',
         #           'liic63',
         #           'X_vvQE5',
         #           'knHm32',
         #           'MP',
         #           'MX',
         #           'MU',
         #           'g_F5eNqA',
         #           'REF',
         #           'pkxaMSv',
         #           'VM'
         #         ];
         # $VAR2 = [
         #           'bBvgmVAIzD',
         #           'BK',
         #           'CF',
         #           'Cjc0SKQz',
         #           'Cp2BGkY',
         #           'CR',
         #           'EMVzKcGR',
         #           'g_F5eNqA',
         #           'knHm32',
         #           'liic63',
         #           'MP',
         #           'MU',
         #           'MX',
         #           'pkxaMSv',
         #           'REF',
         #           'VM',
         #           'WKyaQ_l',
         #           'X_vvQE5',
         #           'x4S8_BaFCp'
         #         ];
We needed the translated_description. It should be the same actually,
but maybe something weird is happening.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
21.11/bug30761
Jonathan Druart 2 years ago
parent
commit
288b39c3d4
  1. 20
      t/db_dependent/Koha/UI/Form/Builder/Item.t

20
t/db_dependent/Koha/UI/Form/Builder/Item.t

@ -113,18 +113,24 @@ subtest 'authorised values' => sub {
my ($subfield) = grep { $_->{kohafield} eq 'items.itype' } @$subfields;
my $itemtypes = Koha::ItemTypes->search;
is_deeply(
$subfield->{marc_value}->{values},
[
"",
my $expected = [
"",
map { $_->itemtype }
# We need to sort using uc or perl won't be case insensitive
sort { uc($a->translated_description) cmp uc($b->translated_description) }
$itemtypes->as_list
],
"Item types should be sorted by description and an empty entries should be shown"
];
is_deeply(
$subfield->{marc_value}->{values},
$expected,
"Item types should be sorted by description and an empty entry should be shown"
)
or diag("Itemtypes details: ".Dumper($subfield->{marc_value}->{values}, [map { $_->itemtype } $itemtypes->as_list]));
or diag("Itemtypes details: " . Dumper(
$subfield->{marc_value}->{values},
$expected,
{ map { $_->itemtype => $_->translated_description } $itemtypes->as_list },
$Koha::Schema::Result::Itemtype::LANGUAGE,
));
is_deeply( $subfield->{marc_value}->{labels},
{ map { $_->itemtype => $_->description } $itemtypes->as_list },

Loading…
Cancel
Save