From 7cce457e5f3eb170469ec8bc84b7f05bac5c7a2a Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 3 Apr 2020 12:12:49 +0000 Subject: [PATCH] Bug 25050: Unit tests This patch simplay alters the data we use for the tests, doing so causes them to fail To test: 1 - Apply only this patch 2 - prove -v t/Koha/SearchEngine/Elasticsearch.t 3 - It fails! 4 - Apply next patch 5 - It passes! --- t/Koha/SearchEngine/Elasticsearch.t | 41 +++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/t/Koha/SearchEngine/Elasticsearch.t b/t/Koha/SearchEngine/Elasticsearch.t index 1bbc48be85..a4608f66f2 100644 --- a/t/Koha/SearchEngine/Elasticsearch.t +++ b/t/Koha/SearchEngine/Elasticsearch.t @@ -644,17 +644,17 @@ subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () authori my @mappings = ( { - name => 'match-heading', + name => 'match', type => 'string', facet => 0, suggestible => 0, searchable => 1, - sort => undef, + sort => 0, marc_type => 'marc21', - marc_field => '150', + marc_field => '150(ae)', }, { - name => 'match-heading', + name => 'heading', type => 'string', facet => 0, suggestible => 0, @@ -664,7 +664,7 @@ subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () authori marc_field => '150a', }, { - name => 'match-heading', + name => 'heading', type => 'string', facet => 0, suggestible => 0, @@ -673,6 +673,36 @@ subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () authori marc_type => 'marc21', marc_field => '150(ae)', }, + { + name => 'heading-main', + type => 'string', + facet => 0, + suggestible => 0, + searchable => 1, + sort => 0, + marc_type => 'marc21', + marc_field => '150a', + }, + { + name => 'heading', + type => 'string', + facet => 0, + suggestible => 0, + searchable => 1, + sort => 0, + marc_type => 'marc21', + marc_field => '150', + }, + { + name => 'match-heading', + type => 'string', + facet => 0, + suggestible => 0, + searchable => 1, + sort => 0, + marc_type => 'marc21', + marc_field => '150', + }, ); my $se = Test::MockModule->new('Koha::SearchEngine::Elasticsearch'); @@ -694,7 +724,6 @@ subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () authori }); my $see = Koha::SearchEngine::Elasticsearch::Search->new({ index => $Koha::SearchEngine::Elasticsearch::AUTHORITIES_INDEX }); - my $marc_record_1 = MARC::Record->new(); $marc_record_1->append_fields( MARC::Field->new('001', '123'), -- 2.11.0