Bugzilla – Attachment 75996 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), 3.72 KB, created by
Jonathan Druart
on 2018-06-12 14:39:35 UTC
(
hide
)
Description:
Bug 18235: Add unit tests for get_facetable_fields
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-06-12 14:39:35 UTC
Size:
3.72 KB
patch
obsolete
>From e7cb4babab3378cc7df85956353f31ff84730b23 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 > >--- > t/db_dependent/Koha_Elasticsearch.t | 109 +++++++++++++++++++++++++++++++++++- > 1 file changed, 108 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha_Elasticsearch.t b/t/db_dependent/Koha_Elasticsearch.t >index 2602619c62..607578180b 100644 >--- a/t/db_dependent/Koha_Elasticsearch.t >+++ b/t/db_dependent/Koha_Elasticsearch.t >@@ -17,13 +17,17 @@ > > use Modern::Perl; > >-use Test::More tests => 2; >+use Test::More tests => 3; > 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; > > use_ok('Koha::SearchEngine::Elasticsearch'); > >@@ -162,3 +166,106 @@ subtest 'get_fixer_rules() tests' => sub { > $schema->storage->txn_rollback; > > }; >+ >+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