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

(-)a/t/db_dependent/AuthorisedValues.t (-8 / +13 lines)
Lines 165-178 subtest 'search_by_*_field + find_by_koha_field + get_description + authorised_v Link Here
165
    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;
166
    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;
167
    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;
168
    Koha::MarcSubfieldStructure->new( { tagfield => '003', frameworkcode => '', authorised_value => 'CONTROL_TEST', } )
169
        ->store;
169
    Koha::AuthorisedValue->new( { category => 'TEST', authorised_value => 'location_1', lib => 'location_1' } )->store;
170
    Koha::AuthorisedValue->new( { category => 'TEST', authorised_value => 'location_1', lib => 'location_1' } )->store;
170
    Koha::AuthorisedValue->new( { category => 'TEST', authorised_value => 'location_2', lib => 'location_2' } )->store;
171
    Koha::AuthorisedValue->new( { category => 'TEST', authorised_value => 'location_2', lib => 'location_2' } )->store;
171
    Koha::AuthorisedValue->new( { category => 'TEST', authorised_value => 'location_3', lib => 'location_3' } )->store;
172
    Koha::AuthorisedValue->new( { category => 'TEST', authorised_value => 'location_3', lib => 'location_3' } )->store;
172
    Koha::AuthorisedValue->new( { category => 'ANOTHER_4_TESTS', authorised_value => 'an_av' } )->store;
173
    Koha::AuthorisedValue->new( { category => 'ANOTHER_4_TESTS', authorised_value => 'an_av' } )->store;
173
    Koha::AuthorisedValue->new( { category => 'ANOTHER_4_TESTS', authorised_value => 'another_av' } )->store;
174
    Koha::AuthorisedValue->new( { category => 'ANOTHER_4_TESTS', authorised_value => 'another_av' } )->store;
175
174
    Koha::AuthorisedValue->new( { category => 'CONTROL_TEST', authorised_value => 'lib1', lib => 'lib1' } )->store;
176
    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;
177
    Koha::AuthorisedValue->new( { category => 'CONTROL_TEST', authorised_value => 'lib2', lib => 'lib2' } )->store;
178
176
    subtest 'search_by_marc_field' => sub {
179
    subtest 'search_by_marc_field' => sub {
177
        plan tests => 4;
180
        plan tests => 4;
178
        my $avs;
181
        my $avs;
Lines 262-269 subtest 'search_by_*_field + find_by_koha_field + get_description + authorised_v Link Here
262
    subtest 'get_descriptions_by_marc_field' => sub {
265
    subtest 'get_descriptions_by_marc_field' => sub {
263
        plan tests => 4;
266
        plan tests => 4;
264
267
265
        my $control_descriptions = Koha::AuthorisedValues->get_descriptions_by_marc_field(
268
        my $control_descriptions =
266
            { frameworkcode => '', tagfield => '003', } );
269
            Koha::AuthorisedValues->get_descriptions_by_marc_field( { frameworkcode => '', tagfield => '003', } );
267
        is_deeply(
270
        is_deeply(
268
            $control_descriptions,
271
            $control_descriptions,
269
            {
272
            {
Lines 272-281 subtest 'search_by_*_field + find_by_koha_field + get_description + authorised_v Link Here
272
            },
275
            },
273
        );
276
        );
274
277
275
        my $control_descriptions_cached = Koha::AuthorisedValues->get_descriptions_by_marc_field(
278
        my $control_descriptions_cached =
276
            { frameworkcode => '', tagfield => '003', } );
279
            Koha::AuthorisedValues->get_descriptions_by_marc_field( { frameworkcode => '', tagfield => '003', } );
277
280
278
        is("$control_descriptions","$control_descriptions_cached","Same memory address used proves cached control desc data");
281
        is(
282
            "$control_descriptions", "$control_descriptions_cached",
283
            "Same memory address used proves cached control desc data"
284
        );
279
285
280
        my $descriptions = Koha::AuthorisedValues->get_descriptions_by_marc_field(
286
        my $descriptions = Koha::AuthorisedValues->get_descriptions_by_marc_field(
281
            { frameworkcode => '', tagfield => '952', tagsubfield => 'c' } );
287
            { frameworkcode => '', tagfield => '952', tagsubfield => 'c' } );
Lines 290-296 subtest 'search_by_*_field + find_by_koha_field + get_description + authorised_v Link Here
290
296
291
        my $descriptions_cached = Koha::AuthorisedValues->get_descriptions_by_marc_field(
297
        my $descriptions_cached = Koha::AuthorisedValues->get_descriptions_by_marc_field(
292
            { frameworkcode => '', tagfield => '952', tagsubfield => 'c' } );
298
            { frameworkcode => '', tagfield => '952', tagsubfield => 'c' } );
293
        is("$descriptions","$descriptions_cached","Same memory address used proves cached desc data");
299
        is( "$descriptions", "$descriptions_cached", "Same memory address used proves cached desc data" );
294
    };
300
    };
295
301
296
    subtest 'authorised_values' => sub {
302
    subtest 'authorised_values' => sub {
297
- 

Return to bug 35588