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

(-)a/t/db_dependent/Koha_Elasticsearch.t (-4 / +14 lines)
Lines 29-35 use_ok('Koha::SearchEngine::Elasticsearch'); Link Here
29
29
30
subtest 'get_fixer_rules() tests' => sub {
30
subtest 'get_fixer_rules() tests' => sub {
31
31
32
    plan tests => 45;
32
    plan tests => 49;
33
33
34
    $schema->storage->txn_begin;
34
    $schema->storage->txn_begin;
35
35
Lines 62-68 subtest 'get_fixer_rules() tests' => sub { Link Here
62
            type => 'string',
62
            type => 'string',
63
            facet => 1,
63
            facet => 1,
64
            suggestible => 1,
64
            suggestible => 1,
65
            sort => '~',
65
            sort => undef,
66
            marc_type => 'marc21',
66
            marc_type => 'marc21',
67
            marc_field => '100a',
67
            marc_field => '100a',
68
        },
68
        },
Lines 71-82 subtest 'get_fixer_rules() tests' => sub { Link Here
71
            type => 'string',
71
            type => 'string',
72
            facet => 1,
72
            facet => 1,
73
            suggestible => 1,
73
            suggestible => 1,
74
            sort => '~',
74
            sort => 1,
75
            marc_type => 'marc21',
75
            marc_type => 'marc21',
76
            marc_field => '110a',
76
            marc_field => '110a',
77
        },
77
        },
78
    );
78
    );
79
79
80
    $see->get_elasticsearch_mappings(); #sort_fields will call this and use the actual db values unless we call it first
80
    my $result = $see->get_fixer_rules();
81
    my $result = $see->get_fixer_rules();
81
    is( $result->[0], q{marc_map('} . $mappings[0]->{marc_field} . q{','} . $mappings[0]->{name} . q{.$append', -split => 1)});
82
    is( $result->[0], q{marc_map('} . $mappings[0]->{marc_field} . q{','} . $mappings[0]->{name} . q{.$append', -split => 1)});
82
    is( $result->[1], q{marc_map('} . $mappings[0]->{marc_field} . q{','} . $mappings[0]->{name} . q{__facet.$append', -split => 1)});
83
    is( $result->[1], q{marc_map('} . $mappings[0]->{marc_field} . q{','} . $mappings[0]->{name} . q{__facet.$append', -split => 1)});
Lines 142-147 subtest 'get_fixer_rules() tests' => sub { Link Here
142
    is( $result->[3], q{marc_map('} . $mappings[1]->{marc_field} . q{','} . $mappings[1]->{name} . q{__sort.$append', -split => 1)});
143
    is( $result->[3], q{marc_map('} . $mappings[1]->{marc_field} . q{','} . $mappings[1]->{name} . q{__sort.$append', -split => 1)});
143
    is( $result->[4], q{move_field(_id,es_id)});
144
    is( $result->[4], q{move_field(_id,es_id)});
144
145
146
    $mappings[0]->{sort}  = 0;
147
    $mappings[1]->{sort}  = undef;
148
149
    $see->get_elasticsearch_mappings(); #sort_fields will call this and use the actual db values unless we call it first
150
    $result = $see->get_fixer_rules();
151
    is( $result->[0], q{marc_map('} . $mappings[0]->{marc_field} . q{','} . $mappings[0]->{name} . q{.$append', -split => 1)});
152
    is( $result->[1], q{marc_map('} . $mappings[1]->{marc_field} . q{','} . $mappings[1]->{name} . q{.$append', -split => 1)});
153
    is( $result->[2], q{marc_map('} . $mappings[1]->{marc_field} . q{','} . $mappings[1]->{name} . q{__sort.$append', -split => 1)});
154
    is( $result->[3], q{move_field(_id,es_id)});
155
145
    t::lib::Mocks::mock_preference( 'marcflavour', 'UNIMARC' );
156
    t::lib::Mocks::mock_preference( 'marcflavour', 'UNIMARC' );
146
157
147
    $result = $see->get_fixer_rules();
158
    $result = $see->get_fixer_rules();
148
- 

Return to bug 19563