Lines 20-26
Link Here
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
use utf8; |
21 |
use utf8; |
22 |
|
22 |
|
23 |
use Test::More tests => 28; |
23 |
use Test::More tests => 29; |
24 |
use Test::Exception; |
24 |
use Test::Exception; |
25 |
use Test::MockModule; |
25 |
use Test::MockModule; |
26 |
|
26 |
|
Lines 33-38
use Koha::Database;
Link Here
|
33 |
use Koha::DateUtils qw( dt_from_string ); |
33 |
use Koha::DateUtils qw( dt_from_string ); |
34 |
use Koha::Old::Items; |
34 |
use Koha::Old::Items; |
35 |
use Koha::Recalls; |
35 |
use Koha::Recalls; |
|
|
36 |
use Koha::AuthorisedValueCategories; |
37 |
use Koha::AuthorisedValues; |
36 |
|
38 |
|
37 |
use List::MoreUtils qw(all); |
39 |
use List::MoreUtils qw(all); |
38 |
|
40 |
|
Lines 2163-2165
subtest 'is_denied_renewal' => sub {
Link Here
|
2163 |
|
2165 |
|
2164 |
$schema->storage->txn_rollback; |
2166 |
$schema->storage->txn_rollback; |
2165 |
}; |
2167 |
}; |
2166 |
- |
2168 |
|
|
|
2169 |
subtest '_fetch_authorised_values' => sub { |
2170 |
plan tests => 1; |
2171 |
|
2172 |
$schema->storage->txn_begin; |
2173 |
|
2174 |
# Delete all Authorised Values of 'Countries' category |
2175 |
Koha::AuthorisedValues->search({category => 'Countries'})->delete; |
2176 |
Koha::AuthorisedValueCategories->search({category_name => 'Countries'})->delete; |
2177 |
|
2178 |
# Create 'Countries' category and authorised value |
2179 |
my $cat = $builder->build_object({ class => 'Koha::AuthorisedValueCategories'}); |
2180 |
my $country = $builder->build_object({ class => 'Koha::AuthorisedValues', value => { category => $cat->category_name } }); |
2181 |
|
2182 |
# Create a new biblio framework |
2183 |
my $fw = $builder->build_object({ class => 'Koha::BiblioFrameworks' }); |
2184 |
|
2185 |
# Add a Marc subfield with kohafield setted to 'items.itemnote' |
2186 |
$builder->build_object({class => 'Koha::MarcSubfieldStructures', value => {frameworkcode => $fw->frameworkcode, authorised_value => $cat->category_name, kohafield => 'items.itemnotes'}}); |
2187 |
|
2188 |
# Create biblio and item |
2189 |
my $biblio = $builder->build_sample_biblio({frameworkcode => $fw->frameworkcode}); |
2190 |
my $item = $builder->build_sample_item({biblionumber => $biblio->biblionumber, itemnotes => $country->authorised_value}); |
2191 |
|
2192 |
# Fetch authorised values |
2193 |
my $avs = $item->_fetch_authorised_values(); |
2194 |
|
2195 |
is($avs->{itemnotes}->{lib}, $country->lib, 'Fetched auhtorised value is ok'); |
2196 |
|
2197 |
$schema->storage->txn_rollback; |
2198 |
}; |