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

(-)a/Koha/AuthorisedValueCategory.pm (+12 lines)
Lines 47-52 sub delete { Link Here
47
    return $self->SUPER::delete;
47
    return $self->SUPER::delete;
48
}
48
}
49
49
50
=head3 authorized_values
51
52
Returns values within the category at hand.
53
54
=cut
55
56
sub values {
57
    my ( $self ) = @_;
58
    my $rs = $self->_result->authorised_values;
59
    return map { $_->authorised_value } $rs->all;
60
}
61
50
=head3 type
62
=head3 type
51
63
52
=cut
64
=cut
(-)a/t/db_dependent/AuthorisedValues.t (-2 / +9 lines)
Lines 1-7 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
2
3
use Modern::Perl;
3
use Modern::Perl;
4
use Test::More tests => 16;
4
use Test::More tests => 17;
5
use Try::Tiny;
5
use Try::Tiny;
6
6
7
use t::lib::TestBuilder;
7
use t::lib::TestBuilder;
Lines 254-257 subtest 'search_by_*_field + find_by_koha_field + get_description' => sub { Link Here
254
    };
254
    };
255
};
255
};
256
256
257
subtest '$category->values' => sub {
258
    plan tests => 1;
259
    Koha::AuthorisedValueCategory->new( { category_name => 'VALUES_TEST' } )->store;
260
    Koha::AuthorisedValue->new({ category => 'VALUES_TEST', authorised_value => 'test1' })->store;
261
    Koha::AuthorisedValue->new({ category => 'VALUES_TEST', authorised_value => 'test2' })->store;
262
    is_deeply( [ sort Koha::AuthorisedValueCategories->find('VALUES_TEST')->values ], [ 'test1', 'test2' ], 'Expecting two values' );
263
};
264
257
$schema->storage->txn_rollback;
265
$schema->storage->txn_rollback;
258
- 

Return to bug 31503