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 2124-2126
subtest 'is_denied_renewal' => sub {
Link Here
|
2124 |
|
2126 |
|
2125 |
$schema->storage->txn_rollback; |
2127 |
$schema->storage->txn_rollback; |
2126 |
}; |
2128 |
}; |
2127 |
- |
2129 |
|
|
|
2130 |
subtest '_fetch_authorised_values' => sub { |
2131 |
plan tests => 1; |
2132 |
|
2133 |
$schema->storage->txn_begin; |
2134 |
|
2135 |
# Delete all Authorised Values of 'Countries' category |
2136 |
Koha::AuthorisedValues->search({category => 'Countries'})->delete; |
2137 |
Koha::AuthorisedValueCategories->search({category_name => 'Countries'})->delete; |
2138 |
|
2139 |
# Create 'Countries' category and authorised value |
2140 |
my $cat = $builder->build_object({ class => 'Koha::AuthorisedValueCategories'}); |
2141 |
my $country = $builder->build_object({ class => 'Koha::AuthorisedValues', value => { category => $cat->category_name } }); |
2142 |
|
2143 |
# Create a new biblio framework |
2144 |
my $fw = $builder->build_object({ class => 'Koha::BiblioFrameworks' }); |
2145 |
|
2146 |
# Add a Marc subfield with kohafield setted to 'items.itemnote' |
2147 |
$builder->build_object({class => 'Koha::MarcSubfieldStructures', value => {frameworkcode => $fw->frameworkcode, authorised_value => $cat->category_name, kohafield => 'items.itemnotes'}}); |
2148 |
|
2149 |
# Create biblio and item |
2150 |
my $biblio = $builder->build_sample_biblio({frameworkcode => $fw->frameworkcode}); |
2151 |
my $item = $builder->build_sample_item({biblionumber => $biblio->biblionumber, itemnotes => $country->authorised_value}); |
2152 |
|
2153 |
# Fetch authorised values |
2154 |
my $avs = $item->_fetch_authorised_values(); |
2155 |
|
2156 |
is($avs->{itemnotes}->{lib}, $country->lib, 'Fetched auhtorised value is ok'); |
2157 |
|
2158 |
$schema->storage->txn_rollback; |
2159 |
}; |