return $cached if $cached;
my $av = $self->find_by_koha_field($params);
+ return {} unless defined $av;
my $descriptions = { lib => $av->lib, opac_description => $av->opac_description };
$memory_cache->set_in_cache( $cache_key, $descriptions );
return $descriptions;
is( $av, undef, );
};
subtest 'get_description_by_koha_field' => sub {
- plan tests => 3;
+ plan tests => 4;
my $descriptions;
# Test authorised_value = 0
$descriptions = Koha::AuthorisedValues->get_description_by_koha_field(
{ kohafield => 'items.restricted', authorised_value => undef } );
is_deeply( $descriptions, {}, ) ; # This could be arguable, we could return undef instead
+
+ # No authorised_value
+ $descriptions = Koha::AuthorisedValues->get_description_by_koha_field(
+ { kohafield => 'items.restricted', authorised_value => "does not exist" } );
+ is_deeply( $descriptions, {}, ) ; # This could be arguable, we could return undef instead
};
subtest 'get_descriptions_by_koha_field' => sub {
plan tests => 1;