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

(-)a/t/db_dependent/AuthorisedValues.t (-2 / +10 lines)
Lines 189-195 subtest 'search_by_*_field + find_by_koha_field + get_description + authorised_v Link Here
189
189
190
    };
190
    };
191
    subtest 'find_by_koha_field' => sub {
191
    subtest 'find_by_koha_field' => sub {
192
        plan tests => 3;
192
        plan tests => 4;
193
        # Test authorised_value = 0
193
        # Test authorised_value = 0
194
        my $av;
194
        my $av;
195
        $av = Koha::AuthorisedValues->find_by_koha_field( { kohafield => 'items.restricted', authorised_value => 0 } );
195
        $av = Koha::AuthorisedValues->find_by_koha_field( { kohafield => 'items.restricted', authorised_value => 0 } );
Lines 200-205 subtest 'search_by_*_field + find_by_koha_field + get_description + authorised_v Link Here
200
        # Test authorised_value = undef => we do not want to retrieve anything
200
        # Test authorised_value = undef => we do not want to retrieve anything
201
        $av = Koha::AuthorisedValues->find_by_koha_field( { kohafield => 'items.restricted', authorised_value => undef } );
201
        $av = Koha::AuthorisedValues->find_by_koha_field( { kohafield => 'items.restricted', authorised_value => undef } );
202
        is( $av, undef, );
202
        is( $av, undef, );
203
        # Test get authorised_value->opac_description if kohafield is in array
204
        my @authorised_kohafields = ( 'location', 'ccode', 'permanent_location', 'notforloan', 'itemlost', 'withdrawn', 'damaged', 'restricted' );
205
        foreach my $kohafield (@authorised_kohafields) {
206
            $av = Koha::AuthorisedValues->find_by_koha_field( { kohafield => 'items.' . $kohafield, authorised_value => 'location_1' } );
207
            if ($av) {
208
                is(
209
                    $av->opac_description, 'location_1', "items.$kohafield description added correctly" );
210
            }
211
        }
203
    };
212
    };
204
    subtest 'get_description_by_koha_field' => sub {
213
    subtest 'get_description_by_koha_field' => sub {
205
        plan tests => 4;
214
        plan tests => 4;
206
- 

Return to bug 31550