Bugzilla – Attachment 86343 Details for
Bug 18235
Elastic search - Configurable facets
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18235: Add unit tests for get_facetable_fields
Bug-18235-Add-unit-tests-for-getfacetablefields.patch (text/plain), 4.25 KB, created by
Josef Moravec
on 2019-03-08 08:11:11 UTC
(
hide
)
Description:
Bug 18235: Add unit tests for get_facetable_fields
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2019-03-08 08:11:11 UTC
Size:
4.25 KB
patch
obsolete
>From 70bb09b0813c552c1de8e60411595e6790a3031c Mon Sep 17 00:00:00 2001 >From: Alex Arnaud <alex.arnaud@gmail.com> >Date: Fri, 23 Mar 2018 15:55:09 +0000 >Subject: [PATCH] Bug 18235: Add unit tests for get_facetable_fields > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > t/db_dependent/Koha_Elasticsearch.t | 131 ++++++++++++++++++++++++++++++++++++ > 1 file changed, 131 insertions(+) > create mode 100644 t/db_dependent/Koha_Elasticsearch.t > >diff --git a/t/db_dependent/Koha_Elasticsearch.t b/t/db_dependent/Koha_Elasticsearch.t >new file mode 100644 >index 0000000000..419ad722d6 >--- /dev/null >+++ b/t/db_dependent/Koha_Elasticsearch.t >@@ -0,0 +1,131 @@ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses> >+ >+use Modern::Perl; >+ >+use Test::More tests => 1; >+use Test::MockModule; >+ >+use t::lib::Mocks; >+use t::lib::TestBuilder; >+use MARC::Record; >+ >+use Koha::SearchFields; >+ >+my $schema = Koha::Database->schema; >+my $builder = t::lib::TestBuilder->new; >+ >+subtest 'get_facetable_fields() tests' => sub { >+ >+ plan tests => 15; >+ >+ $schema->storage->txn_begin; >+ >+ Koha::SearchFields->search()->delete; >+ >+ $builder->build({ >+ source => 'SearchField', >+ value => { >+ name => 'author', >+ label => 'author', >+ type => 'string', >+ facet_order => undef >+ } >+ }); >+ $builder->build({ >+ source => 'SearchField', >+ value => { >+ name => 'holdingbranch', >+ label => 'holdingbranch', >+ type => 'string', >+ facet_order => 1 >+ } >+ }); >+ $builder->build({ >+ source => 'SearchField', >+ value => { >+ name => 'homebranch', >+ label => 'homebranch', >+ type => 'string', >+ facet_order => 2 >+ } >+ }); >+ $builder->build({ >+ source => 'SearchField', >+ value => { >+ name => 'itype', >+ label => 'itype', >+ type => 'string', >+ facet_order => 3 >+ } >+ }); >+ $builder->build({ >+ source => 'SearchField', >+ value => { >+ name => 'se', >+ label => 'se', >+ type => 'string', >+ facet_order => 4 >+ } >+ }); >+ $builder->build({ >+ source => 'SearchField', >+ value => { >+ name => 'su-geo', >+ label => 'su-geo', >+ type => 'string', >+ facet_order => 5 >+ } >+ }); >+ $builder->build({ >+ source => 'SearchField', >+ value => { >+ name => 'subject', >+ label => 'subject', >+ type => 'string', >+ facet_order => 6 >+ } >+ }); >+ $builder->build({ >+ source => 'SearchField', >+ value => { >+ name => 'not_facetable_field', >+ label => 'not_facetable_field', >+ type => 'string', >+ facet_order => undef >+ } >+ }); >+ >+ my @faceted_fields = Koha::SearchEngine::Elasticsearch->get_facetable_fields(); >+ is(scalar(@faceted_fields), 7); >+ >+ is($faceted_fields[0]->name, 'holdingbranch'); >+ is($faceted_fields[0]->facet_order, 1); >+ is($faceted_fields[1]->name, 'homebranch'); >+ is($faceted_fields[1]->facet_order, 2); >+ is($faceted_fields[2]->name, 'itype'); >+ is($faceted_fields[2]->facet_order, 3); >+ is($faceted_fields[3]->name, 'se'); >+ is($faceted_fields[3]->facet_order, 4); >+ is($faceted_fields[4]->name, 'su-geo'); >+ is($faceted_fields[4]->facet_order, 5); >+ is($faceted_fields[5]->name, 'subject'); >+ is($faceted_fields[5]->facet_order, 6); >+ is($faceted_fields[6]->name, 'author'); >+ ok(!$faceted_fields[6]->facet_order); >+ >+ >+ $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 18235
:
60931
|
60932
|
60933
|
61528
|
61529
|
61530
|
64747
|
69485
|
69486
|
69487
|
72936
|
72937
|
72938
|
72999
|
73000
|
73001
|
73193
|
74642
|
74643
|
75995
|
75996
|
85212
|
85213
|
85214
|
85215
|
85216
|
85885
|
85886
|
85969
|
85970
|
85983
|
85984
|
85985
|
85986
|
85987
|
85988
|
85989
|
85990
|
85991
|
85992
|
86340
|
86341
|
86342
|
86343
|
86344
|
86345
|
86346
|
86347
|
86348
|
86349
|
86350
|
86944
|
86945
|
86946
|
86947
|
86948
|
86949
|
86950
|
86951
|
86952
|
86953
|
86954
|
86955
|
86956
|
87141