X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=t%2Fdb_dependent%2FKoha_Elasticsearch.t;h=de344ff3398ba5c97ae6ca2a1b3db152d0fd4e68;hb=eb68ca2af2c9ebf32091f98380dbbd07cd7ff2e6;hp=ef95a03155eb2a700e1fba42123fa12589e6efbd;hpb=540d488e980b2521b424bed0f0267002c6dbd03e;p=koha.git diff --git a/t/db_dependent/Koha_Elasticsearch.t b/t/db_dependent/Koha_Elasticsearch.t index ef95a03155..de344ff339 100644 --- a/t/db_dependent/Koha_Elasticsearch.t +++ b/t/db_dependent/Koha_Elasticsearch.t @@ -29,7 +29,7 @@ use_ok('Koha::SearchEngine::Elasticsearch'); subtest 'get_fixer_rules() tests' => sub { - plan tests => 45; + plan tests => 49; $schema->storage->txn_begin; @@ -62,7 +62,7 @@ subtest 'get_fixer_rules() tests' => sub { type => 'string', facet => 1, suggestible => 1, - sort => '~', + sort => undef, marc_type => 'marc21', marc_field => '100a', }, @@ -71,12 +71,13 @@ subtest 'get_fixer_rules() tests' => sub { type => 'string', facet => 1, suggestible => 1, - sort => '~', + sort => 1, marc_type => 'marc21', marc_field => '110a', }, ); + $see->get_elasticsearch_mappings(); #sort_fields will call this and use the actual db values unless we call it first my $result = $see->get_fixer_rules(); is( $result->[0], q{marc_map('} . $mappings[0]->{marc_field} . q{','} . $mappings[0]->{name} . q{.$append', -split => 1)}); is( $result->[1], q{marc_map('} . $mappings[0]->{marc_field} . q{','} . $mappings[0]->{name} . q{__facet.$append', -split => 1)}); @@ -142,6 +143,16 @@ subtest 'get_fixer_rules() tests' => sub { is( $result->[3], q{marc_map('} . $mappings[1]->{marc_field} . q{','} . $mappings[1]->{name} . q{__sort.$append', -split => 1)}); is( $result->[4], q{move_field(_id,es_id)}); + $mappings[0]->{sort} = 0; + $mappings[1]->{sort} = undef; + + $see->get_elasticsearch_mappings(); #sort_fields will call this and use the actual db values unless we call it first + $result = $see->get_fixer_rules(); + is( $result->[0], q{marc_map('} . $mappings[0]->{marc_field} . q{','} . $mappings[0]->{name} . q{.$append', -split => 1)}); + is( $result->[1], q{marc_map('} . $mappings[1]->{marc_field} . q{','} . $mappings[1]->{name} . q{.$append', -split => 1)}); + is( $result->[2], q{marc_map('} . $mappings[1]->{marc_field} . q{','} . $mappings[1]->{name} . q{__sort.$append', -split => 1)}); + is( $result->[3], q{move_field(_id,es_id)}); + t::lib::Mocks::mock_preference( 'marcflavour', 'UNIMARC' ); $result = $see->get_fixer_rules(); @@ -151,5 +162,3 @@ subtest 'get_fixer_rules() tests' => sub { $schema->storage->txn_rollback; }; - -1;