Bugzilla – Attachment 85891 Details for
Bug 18163
Elasticsearch advanced search by item type not working with item-level_itypes turned off (biblio record)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18163: Unit tests
Bug-18163-Unit-tests.patch (text/plain), 2.75 KB, created by
Josef Moravec
on 2019-03-01 09:20:19 UTC
(
hide
)
Description:
Bug 18163: Unit tests
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2019-03-01 09:20:19 UTC
Size:
2.75 KB
patch
obsolete
>From d755d131bca1e5bc00830fe484b900cc913fea6d Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 25 May 2018 13:04:40 +0000 >Subject: [PATCH] Bug 18163: Unit tests > >prove -v t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t >--- > .../Koha/SearchEngine/Elasticsearch/QueryBuilder.t | 39 +++++++++++++++++++++- > 1 file changed, 38 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t b/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t >index 1a109c6a94..48c86c319f 100644 >--- a/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t >+++ b/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t >@@ -21,7 +21,7 @@ use C4::Context; > use Test::Exception; > use t::lib::Mocks; > use t::lib::TestBuilder; >-use Test::More tests => 6; >+use Test::More tests => 7; > > use Koha::Database; > use Koha::SearchEngine::Elasticsearch::QueryBuilder; >@@ -485,4 +485,41 @@ subtest "_sort_field() tests" => sub { > ); > }; > >+subtest 'build_query_compat() limit tests' => sub { >+ plan tests => 6; >+ >+ my $builder = Koha::SearchEngine::Elasticsearch::QueryBuilder->new({ 'index' => 'biblios' }), >+ my @operators = (); >+ my @operands = (); >+ my @indexes = (); >+ my @orig_limits = ('itype:BK'); >+ my @sort_by = (); >+ my $scan = undef; >+ my $lang = undef; >+ my @params = ( \@operators, \@operands, \@indexes, \@orig_limits, \@sort_by, $scan, $lang ); >+ my (undef, $query, undef, undef, undef, $limit) = $builder->build_query_compat( @params ); >+ is( $limit, ( 'itype:BK' ), "We pass through a known type"); >+ >+ @orig_limits = ('itype:BK2'); >+ (undef, $query, undef, undef, undef, $limit) = $builder->build_query_compat( @params ); >+ is( $limit, ('itype:BK2' ), "We pass through and quote a known type requested as phrase"); >+ >+ @orig_limits = ('ti:monkey'); >+ (undef, $query, undef, undef, undef, $limit) = $builder->build_query_compat( @params ); >+ is( $limit, ('title:monkey' ), "We convert and pass through a known type"); >+ >+ @orig_limits = ('ti,phr:monkey'); >+ (undef, $query, undef, undef, undef, $limit) = $builder->build_query_compat( @params ); >+ is( $limit, ('title:"monkey"' ), "We convert, quote, and pass through a known type requested as phrase"); >+ >+ @orig_limits = ('monkey:banana'); >+ (undef, $query, undef, undef, undef, $limit) = $builder->build_query_compat( @params ); >+ is( $limit, ('monkey:banana' ), "We pass through an unknown type"); >+ >+ @orig_limits = ('ti,phr:monkey'); >+ (undef, $query, undef, undef, undef, $limit) = $builder->build_query_compat( @params ); >+ is( $limit, ('title:"monkey"' ), "We quote and pass through an unknown type requested as phrase"); >+ >+}; >+ > $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 18163
:
75564
|
75565
| 85891 |
85892