Bugzilla – Attachment 99142 Details for
Bug 12430
Relevance ranking should also be used without QueryWeightFields system preference
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
First Draft buildQuery unit test
First-Draft-buildQuery-unit-test.patch (text/plain), 3.10 KB, created by
David Cook
on 2020-02-18 03:03:18 UTC
(
hide
)
Description:
First Draft buildQuery unit test
Filename:
MIME Type:
Creator:
David Cook
Created:
2020-02-18 03:03:18 UTC
Size:
3.10 KB
patch
obsolete
>From ea9c29d945cb1f4c5bffb74445208303c0361d3b Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Tue, 18 Feb 2020 03:02:55 +0000 >Subject: [PATCH] First Draft buildQuery unit test > >https://bugs.koha-community.org/show_bug.cgi?id=12430 >--- > t/Search.t | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 55 insertions(+), 1 deletion(-) > >diff --git a/t/Search.t b/t/Search.t >index 0959c85de0..a953bc957a 100755 >--- a/t/Search.t >+++ b/t/Search.t >@@ -24,7 +24,7 @@ use Module::Load::Conditional qw/check_install/; > > BEGIN { > if ( check_install( module => 'Test::DBIx::Class' ) ) { >- plan tests => 3; >+ plan tests => 6; > } else { > plan skip_all => "Need Test::DBIx::Class" > } >@@ -36,6 +36,60 @@ use Test::DBIx::Class; > use_ok('C4::Search'); > can_ok('C4::Search', > qw/_build_initial_query/); >+can_ok('C4::Search', >+ qw/buildQuery/); >+ >+subtest "buildQuery basic search" => sub { >+ plan tests => 9; >+ t::lib::Mocks::mock_preference('QueryWeightFields', '1'); >+ t::lib::Mocks::mock_preference('QueryAutoTruncate', '1'); >+ t::lib::Mocks::mock_preference('UseQueryParser', '0'); >+ my $operators = []; >+ my $operands = ["test"]; >+ my $indexes = []; >+ my $limits = []; >+ my $sort_by = []; >+ my $scan; >+ my $lang; >+ >+ my ($error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$query_type) = >+ C4::Search::buildQuery($operators,$operands,$indexes,$limits,$sort_by,$scan,$lang); >+ is($error,undef,"Error is correct"); >+ is($query,'(rk=(kw,wrdl,rtrn=test )) ','Query is correct'); >+ is($simple_query,'test',"Simple query is correct"); >+ is($query_cgi,'idx=kw&q=test','Query cgi is correct'); >+ is($query_desc,'kw,wrdl: test','Query desc is correct'); >+ is($limit,undef,"Limit is correct"); >+ is($limit_cgi,undef,"Limit cgi is correct"); >+ is($limit_desc,undef,"Limit desc is correct"); >+ is($query_type,undef,"Query type is correct"); >+}; >+ >+subtest "buildQuery truncated search" => sub { >+ plan tests => 9; >+ t::lib::Mocks::mock_preference('QueryWeightFields', '1'); >+ t::lib::Mocks::mock_preference('QueryAutoTruncate', '1'); >+ t::lib::Mocks::mock_preference('UseQueryParser', '0'); >+ my $operators = []; >+ my $operands = ["test*"]; >+ my $indexes = []; >+ my $limits = []; >+ my $sort_by = []; >+ my $scan; >+ my $lang; >+ >+ my ($error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$query_type) = >+ C4::Search::buildQuery($operators,$operands,$indexes,$limits,$sort_by,$scan,$lang); >+ is($error,undef,"Error is correct"); >+ is($query,'(rk=(kw,wrdl,rtrn=test )) ','Query is correct'); >+ is($simple_query,'test*',"Simple query is correct"); >+ is($query_cgi,'idx=kw&q=test%2A','Query cgi is correct'); >+ is($query_desc,'kw,wrdl: test*','Query desc is correct'); >+ is($limit,undef,"Limit is correct"); >+ is($limit_cgi,undef,"Limit cgi is correct"); >+ is($limit_desc,undef,"Limit desc is correct"); >+ is($query_type,undef,"Query type is correct"); >+}; > > subtest "_build_initial_query tests" => sub { > >-- >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 12430
:
28880
|
96167
|
98188
|
98619
|
99141
|
99142
|
99158
|
114129
|
114130
|
114131
|
114132
|
114137
|
114138
|
114200
|
114205
|
114275