Bugzilla – Attachment 110175 Details for
Bug 23828
Elasticsearch - ES - Authority record results not ordered correctly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23828: Unit tests
Bug-23828-Unit-tests.patch (text/plain), 4.96 KB, created by
Nick Clemens (kidclamp)
on 2020-09-16 11:54:30 UTC
(
hide
)
Description:
Bug 23828: Unit tests
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2020-09-16 11:54:30 UTC
Size:
4.96 KB
patch
obsolete
>From 0abd7ea62f109bd085c48d371383a8ce5c407ba6 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 16 Sep 2020 11:31:48 +0000 >Subject: [PATCH] Bug 23828: Unit tests > >--- > t/db_dependent/Koha/SearchEngine/Elasticsearch.t | 38 ++++++++++++++++++------ > 1 file changed, 29 insertions(+), 9 deletions(-) > >diff --git a/t/db_dependent/Koha/SearchEngine/Elasticsearch.t b/t/db_dependent/Koha/SearchEngine/Elasticsearch.t >index 12c3599885..336f290acb 100755 >--- a/t/db_dependent/Koha/SearchEngine/Elasticsearch.t >+++ b/t/db_dependent/Koha/SearchEngine/Elasticsearch.t >@@ -132,7 +132,7 @@ subtest 'get_elasticsearch_mappings() tests' => sub { > > subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' => sub { > >- plan tests => 53; >+ plan tests => 55; > > t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); > t::lib::Mocks::mock_preference('ElasticsearchMARCFormat', 'ISO2709'); >@@ -298,6 +298,16 @@ subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' > marc_type => 'marc21', > marc_field => '952l', > }, >+ { >+ name => 'subject', >+ type => 'string', >+ facet => 0, >+ suggestible => 0, >+ searchable => 1, >+ sort => 1, >+ marc_type => 'marc21', >+ marc_field => '650(avxyz)', >+ }, > ); > > my $se = Test::MockModule->new('Koha::SearchEngine::Elasticsearch'); >@@ -335,6 +345,8 @@ subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' > MARC::Field->new('210', '', '', a => 'Title 1'), > MARC::Field->new('240', '', '4', a => 'The uniform title with nonfiling indicator'), > MARC::Field->new('245', '', '', a => 'Title:', b => 'first record'), >+ MARC::Field->new('650', '', '', a => 'Heading', z => 'Geohead', v => 'Formhead'), >+ MARC::Field->new('650', '', '', a => 'Heading', x => 'Gensubhead', z => 'Geohead'), > MARC::Field->new('999', '', '', c => '1234567'), > # ' ' for testing trimming of white space in boolean value callback: > MARC::Field->new('952', '', '', 0 => ' ', g => '123.30', o => $callno, l => 3), >@@ -366,6 +378,9 @@ subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' > is(scalar @{$docs->[0]->{author}}, 2, 'First document author field should contain two values'); > is_deeply($docs->[0]->{author}, ['Author 1', 'Corp Author'], 'First document author field should be set correctly'); > >+ is(scalar @{$docs->[0]->{subject}}, 2, 'First document subject field should contain two values'); >+ is_deeply($docs->[0]->{subject}, ['Heading Geohead Formhead', 'Heading Gensubhead Geohead'], 'First document asubject field should be set correctly, record order preserved for grouped subfield mapping'); >+ > is(scalar @{$docs->[0]->{author__sort}}, 1, 'First document author__sort field should have a single value'); > is_deeply($docs->[0]->{author__sort}, ['Author 1 Corp Author'], 'First document author__sort field should be set correctly'); > >@@ -651,7 +666,7 @@ subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents_array () t > > subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () authority tests' => sub { > >- plan tests => 2; >+ plan tests => 3; > > t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); > t::lib::Mocks::mock_preference('ElasticsearchMARCFormat', 'ISO2709'); >@@ -671,7 +686,7 @@ subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () authori > searchable => 1, > sort => 0, > marc_type => 'marc21', >- marc_field => '150(ae)', >+ marc_field => '150(aevxyz)', > } > ); > >@@ -711,16 +726,21 @@ subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () authori > > my $docs = $see->marc_records_to_documents($records); > >- ok( >- any { $_ eq "Subject formsubdiv Genresubdiv generalsubdiv Generalsubdiv geographicsubdiv Geosubdiv" } >- @{$docs->[0]->{'match-heading'}}, >+ is_deeply( >+ [ "Subject formsubdiv Genresubdiv generalsubdiv Generalsubdiv geographicsubdiv Geosubdiv" ], >+ $docs->[0]->{'match-heading'}, > "First record match-heading should contain the correctly formatted heading" > ); >- ok( >- any { $_ eq "Subject formsubdiv Genresubdiv geographicsubdiv Geosubdiv generalsubdiv Generalsubdiv" } >- @{$docs->[1]->{'match-heading'}}, >+ is_deeply( >+ [ "Subject formsubdiv Genresubdiv geographicsubdiv Geosubdiv generalsubdiv Generalsubdiv" ], >+ $docs->[1]->{'match-heading'}, > "Second record match-heading should contain the correctly formatted heading without wrong subfield" > ); >+ is_deeply( >+ [ "Subject Genresubdiv Geosubdiv Generalsubdiv wrongsubdiv" ], >+ $docs->[1]->{'match'} , >+ "Second record heading should contain the subfields with record order retained" >+ ); > }; > > $schema->storage->txn_rollback; >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23828
:
110175
|
110176
|
110547
|
110548
|
111329
|
111330
|
111813
|
111814
|
111815
|
112142
|
112143