Lines 156-172
subtest 'search_by_*_field + find_by_koha_field + get_description + authorised_v
Link Here
|
156 |
$mss->delete if $mss; |
156 |
$mss->delete if $mss; |
157 |
$mss = Koha::MarcSubfieldStructures->search( { tagfield => 952, tagsubfield => '5', frameworkcode => '' } ); |
157 |
$mss = Koha::MarcSubfieldStructures->search( { tagfield => 952, tagsubfield => '5', frameworkcode => '' } ); |
158 |
$mss->delete if $mss; |
158 |
$mss->delete if $mss; |
|
|
159 |
$mss = Koha::MarcSubfieldStructures->search( { tagfield => '003', frameworkcode => '' } ); |
160 |
$mss->delete if $mss; |
159 |
Koha::AuthorisedValueCategory->new( { category_name => 'TEST' } )->store; |
161 |
Koha::AuthorisedValueCategory->new( { category_name => 'TEST' } )->store; |
|
|
162 |
Koha::AuthorisedValueCategory->new( { category_name => 'CONTROL_TEST' } )->store; |
160 |
Koha::AuthorisedValueCategory->new( { category_name => 'ANOTHER_4_TESTS' } )->store; |
163 |
Koha::AuthorisedValueCategory->new( { category_name => 'ANOTHER_4_TESTS' } )->store; |
161 |
Koha::MarcSubfieldStructure->new( { tagfield => 952, tagsubfield => 'c', frameworkcode => '', authorised_value => 'TEST', kohafield => 'items.location' } )->store; |
164 |
Koha::MarcSubfieldStructure->new( { tagfield => 952, tagsubfield => 'c', frameworkcode => '', authorised_value => 'TEST', kohafield => 'items.location' } )->store; |
162 |
Koha::MarcSubfieldStructure->new( { tagfield => 952, tagsubfield => 'c', frameworkcode => 'ACQ', authorised_value => 'TEST', kohafield => 'items.location' } )->store; |
165 |
Koha::MarcSubfieldStructure->new( { tagfield => 952, tagsubfield => 'c', frameworkcode => 'ACQ', authorised_value => 'TEST', kohafield => 'items.location' } )->store; |
163 |
Koha::MarcSubfieldStructure->new( { tagfield => 952, tagsubfield => 'd', frameworkcode => '', authorised_value => 'ANOTHER_4_TESTS', kohafield => 'items.another_field' } )->store; |
166 |
Koha::MarcSubfieldStructure->new( { tagfield => 952, tagsubfield => 'd', frameworkcode => '', authorised_value => 'ANOTHER_4_TESTS', kohafield => 'items.another_field' } )->store; |
164 |
Koha::MarcSubfieldStructure->new( { tagfield => 952, tagsubfield => '5', frameworkcode => '', authorised_value => 'restricted_for_testing', kohafield => 'items.restricted' } )->store; |
167 |
Koha::MarcSubfieldStructure->new( { tagfield => 952, tagsubfield => '5', frameworkcode => '', authorised_value => 'restricted_for_testing', kohafield => 'items.restricted' } )->store; |
|
|
168 |
Koha::MarcSubfieldStructure->new( { tagfield => '003', frameworkcode => '', authorised_value => 'CONTROL_TEST', } )->store; |
165 |
Koha::AuthorisedValue->new( { category => 'TEST', authorised_value => 'location_1', lib => 'location_1' } )->store; |
169 |
Koha::AuthorisedValue->new( { category => 'TEST', authorised_value => 'location_1', lib => 'location_1' } )->store; |
166 |
Koha::AuthorisedValue->new( { category => 'TEST', authorised_value => 'location_2', lib => 'location_2' } )->store; |
170 |
Koha::AuthorisedValue->new( { category => 'TEST', authorised_value => 'location_2', lib => 'location_2' } )->store; |
167 |
Koha::AuthorisedValue->new( { category => 'TEST', authorised_value => 'location_3', lib => 'location_3' } )->store; |
171 |
Koha::AuthorisedValue->new( { category => 'TEST', authorised_value => 'location_3', lib => 'location_3' } )->store; |
168 |
Koha::AuthorisedValue->new( { category => 'ANOTHER_4_TESTS', authorised_value => 'an_av' } )->store; |
172 |
Koha::AuthorisedValue->new( { category => 'ANOTHER_4_TESTS', authorised_value => 'an_av' } )->store; |
169 |
Koha::AuthorisedValue->new( { category => 'ANOTHER_4_TESTS', authorised_value => 'another_av' } )->store; |
173 |
Koha::AuthorisedValue->new( { category => 'ANOTHER_4_TESTS', authorised_value => 'another_av' } )->store; |
|
|
174 |
Koha::AuthorisedValue->new( { category => 'CONTROL_TEST', authorised_value => 'lib1', lib => 'lib1' } )->store; |
175 |
Koha::AuthorisedValue->new( { category => 'CONTROL_TEST', authorised_value => 'lib2', lib => 'lib2' } )->store; |
170 |
subtest 'search_by_marc_field' => sub { |
176 |
subtest 'search_by_marc_field' => sub { |
171 |
plan tests => 4; |
177 |
plan tests => 4; |
172 |
my $avs; |
178 |
my $avs; |
Lines 254-260
subtest 'search_by_*_field + find_by_koha_field + get_description + authorised_v
Link Here
|
254 |
}; |
260 |
}; |
255 |
|
261 |
|
256 |
subtest 'get_descriptions_by_marc_field' => sub { |
262 |
subtest 'get_descriptions_by_marc_field' => sub { |
257 |
plan tests => 1; |
263 |
plan tests => 4; |
|
|
264 |
|
265 |
my $control_descriptions = Koha::AuthorisedValues->get_descriptions_by_marc_field( |
266 |
{ frameworkcode => '', tagfield => '003', } ); |
267 |
is_deeply( |
268 |
$control_descriptions, |
269 |
{ |
270 |
'lib1' => 'lib1', |
271 |
'lib2' => 'lib2', |
272 |
}, |
273 |
); |
274 |
|
275 |
my $control_descriptions_cached = Koha::AuthorisedValues->get_descriptions_by_marc_field( |
276 |
{ frameworkcode => '', tagfield => '003', } ); |
277 |
|
278 |
is("$control_descriptions","$control_descriptions_cached","Same memory address used proves cached control desc data"); |
279 |
|
258 |
my $descriptions = Koha::AuthorisedValues->get_descriptions_by_marc_field( |
280 |
my $descriptions = Koha::AuthorisedValues->get_descriptions_by_marc_field( |
259 |
{ frameworkcode => '', tagfield => '952', tagsubfield => 'c' } ); |
281 |
{ frameworkcode => '', tagfield => '952', tagsubfield => 'c' } ); |
260 |
is_deeply( |
282 |
is_deeply( |
Lines 265-270
subtest 'search_by_*_field + find_by_koha_field + get_description + authorised_v
Link Here
|
265 |
'location_3' => 'location_3', |
287 |
'location_3' => 'location_3', |
266 |
}, |
288 |
}, |
267 |
); |
289 |
); |
|
|
290 |
|
291 |
my $descriptions_cached = Koha::AuthorisedValues->get_descriptions_by_marc_field( |
292 |
{ frameworkcode => '', tagfield => '952', tagsubfield => 'c' } ); |
293 |
is("$descriptions","$descriptions_cached","Same memory address used proves cached desc data"); |
268 |
}; |
294 |
}; |
269 |
|
295 |
|
270 |
subtest 'authorised_values' => sub { |
296 |
subtest 'authorised_values' => sub { |
271 |
- |
|
|