Bugzilla – Attachment 72794 Details for
Bug 19582
Elasticsearch: Auth-finder.pl must use search_auth_compat
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19582: Unit tests
Bug-19582-Unit-tests.patch (text/plain), 2.63 KB, created by
Alex Arnaud
on 2018-03-13 15:13:34 UTC
(
hide
)
Description:
Bug 19582: Unit tests
Filename:
MIME Type:
Creator:
Alex Arnaud
Created:
2018-03-13 15:13:34 UTC
Size:
2.63 KB
patch
obsolete
>From a1b08116e8c178ecf923fd676d742665e6437a00 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 7 Nov 2017 01:24:56 +0000 >Subject: [PATCH] Bug 19582: Unit tests > >Signed-off-by: David Bourgault <david.bourgault@inlibro.com> > >Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr> >Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com> >--- > .../Koha/SearchEngine/Elasticsearch/QueryBuilder.t | 28 ++++++++++++++++++++-- > 1 file changed, 26 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t b/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t >index 50dd212..025c788 100644 >--- a/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t >+++ b/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t >@@ -17,11 +17,11 @@ > > use Modern::Perl; > >-use Test::More tests => 1; >+use Test::More tests => 2; > use Test::Exception; > > use Koha::Database; >-use Koha::SearchEngine::Elasticsearch::QueryBuilder; >+use Koha::SearchEngine::Elasticsearch::QueryBuilder > > subtest 'build_authorities_query_compat() tests' => sub { > >@@ -53,3 +53,27 @@ subtest 'build_authorities_query_compat() tests' => sub { > 'Koha::Exceptions::WrongParameter', > 'Exception thrown on invalid value in the marclist param'; > }; >+ >+subtest 'build query from form subtests' => sub { >+ plan tests => 5; >+ >+ my $builder = Koha::SearchEngine::Elasticsearch::QueryBuilder->new({ 'index' => 'authorities' }), >+ #when searching for authorities from a record the form returns marclist with blanks for unentered terms >+ my @marclist = ('mainmainentry','mainentry','match', 'all'); >+ my @values = ( undef, 'Hamilton', undef, undef); >+ my @operator = ( 'contains', 'contains', 'contains', 'contains'); >+ >+ my $query = $builder->build_authorities_query_compat( \@marclist, undef, >+ undef, \@operator , \@values, 'AUTH_TYPE', 'asc' ); >+ is($query->{query}->{bool}->{should}[0]->{match}->{'Heading'}, "Hamilton","Expected search is populated"); >+ is( scalar @{ $query->{query}->{bool}->{should} }, 1,"Only defined search is populated"); >+ >+ @values[2] = 'Jefferson'; >+ $query = $builder->build_authorities_query_compat( \@marclist, undef, >+ undef, \@operator , \@values, 'AUTH_TYPE', 'asc' ); >+ is($query->{query}->{bool}->{should}[0]->{match}->{'Heading'}, "Hamilton","First index searched as expected"); >+ is($query->{query}->{bool}->{should}[1]->{match}->{'Match'}, "Jefferson","Second index searched when populated"); >+ is( scalar @{ $query->{query}->{bool}->{should} }, 2,"Only defined searches are populated"); >+ >+ >+}; >-- >2.7.4
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 19582
:
68984
|
68992
|
68993
|
69031
|
69032
|
72717
|
72782
|
72783
|
72784
|
72792
|
72793
| 72794 |
72795
|
72796