|
Lines 159-167
subtest 'search_by_*_field + find_by_koha_field + get_description' => sub {
Link Here
|
| 159 |
Koha::MarcSubfieldStructure->new( { tagfield => 952, tagsubfield => 'c', frameworkcode => 'ACQ', authorised_value => 'TEST', kohafield => 'items.location' } )->store; |
159 |
Koha::MarcSubfieldStructure->new( { tagfield => 952, tagsubfield => 'c', frameworkcode => 'ACQ', authorised_value => 'TEST', kohafield => 'items.location' } )->store; |
| 160 |
Koha::MarcSubfieldStructure->new( { tagfield => 952, tagsubfield => 'd', frameworkcode => '', authorised_value => 'ANOTHER_4_TESTS', kohafield => 'items.another_field' } )->store; |
160 |
Koha::MarcSubfieldStructure->new( { tagfield => 952, tagsubfield => 'd', frameworkcode => '', authorised_value => 'ANOTHER_4_TESTS', kohafield => 'items.another_field' } )->store; |
| 161 |
Koha::MarcSubfieldStructure->new( { tagfield => 952, tagsubfield => '5', frameworkcode => '', authorised_value => 'restricted_for_testing', kohafield => 'items.restricted' } )->store; |
161 |
Koha::MarcSubfieldStructure->new( { tagfield => 952, tagsubfield => '5', frameworkcode => '', authorised_value => 'restricted_for_testing', kohafield => 'items.restricted' } )->store; |
| 162 |
Koha::AuthorisedValue->new( { category => 'TEST', authorised_value => 'location_1' } )->store; |
162 |
Koha::AuthorisedValue->new( { category => 'TEST', authorised_value => 'location_1', lib => 'location_1' } )->store; |
| 163 |
Koha::AuthorisedValue->new( { category => 'TEST', authorised_value => 'location_2' } )->store; |
163 |
Koha::AuthorisedValue->new( { category => 'TEST', authorised_value => 'location_2', lib => 'location_2' } )->store; |
| 164 |
Koha::AuthorisedValue->new( { category => 'TEST', authorised_value => 'location_3' } )->store; |
164 |
Koha::AuthorisedValue->new( { category => 'TEST', authorised_value => 'location_3', lib => 'location_3' } )->store; |
| 165 |
Koha::AuthorisedValue->new( { category => 'ANOTHER_4_TESTS', authorised_value => 'an_av' } )->store; |
165 |
Koha::AuthorisedValue->new( { category => 'ANOTHER_4_TESTS', authorised_value => 'an_av' } )->store; |
| 166 |
Koha::AuthorisedValue->new( { category => 'ANOTHER_4_TESTS', authorised_value => 'another_av' } )->store; |
166 |
Koha::AuthorisedValue->new( { category => 'ANOTHER_4_TESTS', authorised_value => 'another_av' } )->store; |
| 167 |
subtest 'search_by_marc_field' => sub { |
167 |
subtest 'search_by_marc_field' => sub { |
|
Lines 180-186
subtest 'search_by_*_field + find_by_koha_field + get_description' => sub {
Link Here
|
| 180 |
my $avs; |
180 |
my $avs; |
| 181 |
$avs = Koha::AuthorisedValues->search_by_koha_field(); |
181 |
$avs = Koha::AuthorisedValues->search_by_koha_field(); |
| 182 |
is ( $avs, undef ); |
182 |
is ( $avs, undef ); |
| 183 |
$avs = Koha::AuthorisedValues->search_by_koha_field( { kohafield => 'items.location', tagfield => 952, tagsubfield => 'c' } ); |
183 |
$avs = Koha::AuthorisedValues->search_by_koha_field( { kohafield => 'items.location' } ); |
| 184 |
is( $avs->count, 3, ); |
184 |
is( $avs->count, 3, ); |
| 185 |
is( $avs->next->authorised_value, 'location_1', ); |
185 |
is( $avs->next->authorised_value, 'location_1', ); |
| 186 |
|
186 |
|
|
Lines 236-250
subtest 'search_by_*_field + find_by_koha_field + get_description' => sub {
Link Here
|
| 236 |
is_deeply( |
236 |
is_deeply( |
| 237 |
\@descriptions, |
237 |
\@descriptions, |
| 238 |
[ |
238 |
[ |
| 239 |
{ |
|
|
| 240 |
authorised_value => '', |
| 241 |
lib => $av_empty_string->lib, |
| 242 |
opac_description => $av_empty_string->lib_opac |
| 243 |
}, |
| 244 |
{ |
239 |
{ |
| 245 |
authorised_value => $av_0->authorised_value, |
240 |
authorised_value => $av_0->authorised_value, |
| 246 |
lib => $av_0->lib, |
241 |
lib => $av_0->lib, |
| 247 |
opac_description => $av_0->lib_opac |
242 |
opac_description => $av_0->lib_opac |
|
|
243 |
}, |
| 244 |
{ |
| 245 |
authorised_value => '', |
| 246 |
lib => $av_empty_string->lib, |
| 247 |
opac_description => $av_empty_string->lib_opac |
| 248 |
} |
248 |
} |
| 249 |
], |
249 |
], |
| 250 |
); |
250 |
); |
| 251 |
- |
|
|