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

(-)a/t/db_dependent/Koha/UI/Form/Builder/Item.t (-8 / +13 lines)
Lines 113-130 subtest 'authorised values' => sub { Link Here
113
        my ($subfield) = grep { $_->{kohafield} eq 'items.itype' } @$subfields;
113
        my ($subfield) = grep { $_->{kohafield} eq 'items.itype' } @$subfields;
114
        my $itemtypes = Koha::ItemTypes->search;
114
        my $itemtypes = Koha::ItemTypes->search;
115
115
116
        is_deeply(
116
        my $expected = [
117
            $subfield->{marc_value}->{values},
117
            "",
118
            [
119
                "",
120
                map    { $_->itemtype }
118
                map    { $_->itemtype }
121
                  # We need to sort using uc or perl won't be case insensitive
119
                  # We need to sort using uc or perl won't be case insensitive
122
                  sort { uc($a->translated_description) cmp uc($b->translated_description) }
120
                  sort { uc($a->translated_description) cmp uc($b->translated_description) }
123
                  $itemtypes->as_list
121
                  $itemtypes->as_list
124
            ],
122
            ];
125
            "Item types should be sorted by description and an empty entries should be shown"
123
        is_deeply(
124
            $subfield->{marc_value}->{values},
125
            $expected,
126
            "Item types should be sorted by description and an empty entry should be shown"
126
        )
127
        )
127
        or diag("Itemtypes details: ".Dumper($subfield->{marc_value}->{values}, [map { $_->itemtype } $itemtypes->as_list]));
128
        or diag("Itemtypes details: " . Dumper(
129
            $subfield->{marc_value}->{values},
130
            $expected,
131
            { map { $_->itemtype => $_->translated_description } $itemtypes->as_list },
132
            $Koha::Schema::Result::Itemtype::LANGUAGE,
133
        ));
128
134
129
        is_deeply( $subfield->{marc_value}->{labels},
135
        is_deeply( $subfield->{marc_value}->{labels},
130
            { map { $_->itemtype => $_->description } $itemtypes->as_list },
136
            { map { $_->itemtype => $_->description } $itemtypes->as_list },
131
- 

Return to bug 28445