Bugzilla – Attachment 103779 Details for
Bug 25229
Elasticsearch should use the authid (record id) rather than the 001 when returning auth search results
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25229: Unit test
Bug-25229-Unit-test.patch (text/plain), 2.89 KB, created by
Jonathan Druart
on 2020-04-27 12:49:16 UTC
(
hide
)
Description:
Bug 25229: Unit test
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-04-27 12:49:16 UTC
Size:
2.89 KB
patch
obsolete
>From 69657e865567b60f98159c71960d8ce956e845c2 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Mon, 27 Apr 2020 11:28:51 +0000 >Subject: [PATCH] Bug 25229: Unit test > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > t/Koha/SearchEngine/Elasticsearch/Search.t | 65 ++++++++++++++++++++++ > 1 file changed, 65 insertions(+) > create mode 100644 t/Koha/SearchEngine/Elasticsearch/Search.t > >diff --git a/t/Koha/SearchEngine/Elasticsearch/Search.t b/t/Koha/SearchEngine/Elasticsearch/Search.t >new file mode 100644 >index 0000000000..a6ffd42069 >--- /dev/null >+++ b/t/Koha/SearchEngine/Elasticsearch/Search.t >@@ -0,0 +1,65 @@ >+#!/usr/bin/perl >+# >+# 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 => 2; >+use Test::MockModule; >+use t::lib::Mocks; >+ >+use_ok('Koha::SearchEngine::Elasticsearch::Search'); >+ >+subtest 'search_auth_compat' => sub { >+ plan tests => 2; >+ >+ t::lib::Mocks::mock_preference('QueryRegexEscapeOptions', 'dont_escape'); >+ >+ my $module = Test::MockModule->new('Koha::SearchEngine::Elasticsearch::Search'); >+ $module->mock('count_auth_use', sub { return 1 }); >+ $module->mock('search', sub { >+ # While the 001 and the authid should be the same, it is not always the case >+ # The _id is always the authid and so should be our source of trutch >+ my $marc_record = MARC::Record->new(); >+ $marc_record->append_fields( >+ MARC::Field->new('001', 'Wrong001Number'), >+ ); >+ return { >+ hits => { >+ hits => [{ >+ '_id' => 8675309, >+ '_source' => { >+ 'local-number' => ['Wrong001Number'], >+ 'marc_data' => $marc_record, >+ 'marc_format' => 'base64ISO2709', >+ }, >+ }] >+ } >+ }; >+ }); >+ my $search; >+ ok( >+ $search = Koha::SearchEngine::Elasticsearch::Search->new({ 'index' => $Koha::SearchEngine::Elasticsearch::AUTHORITIES_INDEX }), >+ 'Creating a new Search object' >+ ); >+ >+ my ( $results, undef ) = $search->search_auth_compat('faked'); >+ >+ is( @$results[0]->{authid}, '8675309', 'We get the expected record _id and not the 001'); >+ >+}; >+ >+1; >-- >2.20.1
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 25229
:
103376
|
103738
|
103759
|
103760
|
103761
| 103779 |
103780
|
103781