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

(-)a/t/Koha/SearchEngine/Elasticsearch.t (-5 / +17 lines)
Lines 117-123 subtest 'get_elasticsearch_mappings() tests' => sub { Link Here
117
117
118
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' => sub {
118
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' => sub {
119
119
120
    plan tests => 50;
120
    plan tests => 52;
121
121
122
    t::lib::Mocks::mock_preference('marcflavour', 'MARC21');
122
    t::lib::Mocks::mock_preference('marcflavour', 'MARC21');
123
    t::lib::Mocks::mock_preference('ElasticsearchMARCFormat', 'ISO2709');
123
    t::lib::Mocks::mock_preference('ElasticsearchMARCFormat', 'ISO2709');
Lines 263-268 subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' Link Here
263
            marc_type => 'marc21',
263
            marc_type => 'marc21',
264
            marc_field => '007_/0',
264
            marc_field => '007_/0',
265
        },
265
        },
266
        {
267
            name => 'issues',
268
            type => 'sum',
269
            facet => 0,
270
            suggestible => 0,
271
            searchable => 1,
272
            sort => 1,
273
            marc_type => 'marc21',
274
            marc_field => '952l',
275
        },
266
    );
276
    );
267
277
268
    my $se = Test::MockModule->new('Koha::SearchEngine::Elasticsearch');
278
    my $se = Test::MockModule->new('Koha::SearchEngine::Elasticsearch');
Lines 301-309 subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' Link Here
301
        MARC::Field->new('245', '', '', a => 'Title:', b => 'first record'),
311
        MARC::Field->new('245', '', '', a => 'Title:', b => 'first record'),
302
        MARC::Field->new('999', '', '', c => '1234567'),
312
        MARC::Field->new('999', '', '', c => '1234567'),
303
        # '  ' for testing trimming of white space in boolean value callback:
313
        # '  ' for testing trimming of white space in boolean value callback:
304
        MARC::Field->new('952', '', '', 0 => '  ', g => '123.30', o => $callno),
314
        MARC::Field->new('952', '', '', 0 => '  ', g => '123.30', o => $callno, l => 3),
305
        MARC::Field->new('952', '', '', 0 => 0, g => '127.20', o => $callno2),
315
        MARC::Field->new('952', '', '', 0 => 0, g => '127.20', o => $callno2, l => 2),
306
        MARC::Field->new('952', '', '', 0 => 1, g => '0.00', o => $long_callno),
316
        MARC::Field->new('952', '', '', 0 => 1, g => '0.00', o => $long_callno, l => 1),
307
    );
317
    );
308
    my $marc_record_2 = MARC::Record->new();
318
    my $marc_record_2 = MARC::Record->new();
309
    $marc_record_2->leader('     cam  22      a 4500');
319
    $marc_record_2->leader('     cam  22      a 4500');
Lines 337-342 subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' Link Here
337
    is(scalar @{$docs->[0][1]->{title__sort}}, 1, 'First document title__sort field should have a single');
347
    is(scalar @{$docs->[0][1]->{title__sort}}, 1, 'First document title__sort field should have a single');
338
    is_deeply($docs->[0][1]->{title__sort}, ['Title: first record Title: first record'], 'First document title__sort field should be set correctly');
348
    is_deeply($docs->[0][1]->{title__sort}, ['Title: first record Title: first record'], 'First document title__sort field should be set correctly');
339
349
350
    is($docs->[0][1]->{issues}, 6, 'Issues field should be sum of the issues for each item');
351
    is($docs->[0][1]->{issues__sort}, 6, 'Issues sort field should also be a sum of the issues');
352
340
    is(scalar @{$docs->[0][1]->{title_wildcard}}, 2, 'First document title_wildcard field should have two values');
353
    is(scalar @{$docs->[0][1]->{title_wildcard}}, 2, 'First document title_wildcard field should have two values');
341
    is_deeply($docs->[0][1]->{title_wildcard}, ['Title:', 'first record'], 'First document title_wildcard field should be set correctly');
354
    is_deeply($docs->[0][1]->{title_wildcard}, ['Title:', 'first record'], 'First document title_wildcard field should be set correctly');
342
355
343
- 

Return to bug 23089