Bugzilla – Attachment 104509 Details for
Bug 25342
Scripts not running under plack can cause duplication of ES records
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25342: Unit test
Bug-25342-Unit-test.patch (text/plain), 1.67 KB, created by
Nick Clemens (kidclamp)
on 2020-05-07 13:08:32 UTC
(
hide
)
Description:
Bug 25342: Unit test
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2020-05-07 13:08:32 UTC
Size:
1.67 KB
patch
obsolete
>From c753a7c7db7f65b61a0ffe9d69e5c3f9af29e6e3 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 7 May 2020 13:08:14 +0000 >Subject: [PATCH] Bug 25342: Unit test > >--- > .../Koha/SearchEngine/Elasticsearch/Indexer.t | 29 +++++++++++++++++++++- > 1 file changed, 28 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/SearchEngine/Elasticsearch/Indexer.t b/t/db_dependent/Koha/SearchEngine/Elasticsearch/Indexer.t >index 24f377df40..31bda7a885 100644 >--- a/t/db_dependent/Koha/SearchEngine/Elasticsearch/Indexer.t >+++ b/t/db_dependent/Koha/SearchEngine/Elasticsearch/Indexer.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 2; >+use Test::More tests => 3; > use Test::MockModule; > use t::lib::Mocks; > >@@ -70,3 +70,30 @@ subtest 'create_index() tests' => sub { > 'Dropping the index' > ); > }; >+ >+ >+subtest 'update_index() tests' => sub { >+ plan tests => 2; >+ my $kse = Test::MockModule->new( 'Koha::SearchEngine::Elasticsearch' ); >+ $kse->mock( 'marc_records_to_documents', sub { >+ my ($self, $params ) = @_; >+ return [1]; >+ }); >+ >+ my $indexer; >+ ok( >+ $indexer = Koha::SearchEngine::Elasticsearch::Indexer->new({ 'index' => 'biblios' }), >+ 'Creating a new indexer object' >+ ); >+ >+ my $searcher = $indexer->get_elasticsearch(); >+ my $se = Test::MockModule->new( ref $searcher ); >+ $se->mock( 'bulk', sub { >+ my ($self, %params ) = @_; >+ return $params{body}; >+ }); >+ >+ my $bibnumber_array = $indexer->update_index([13],["faked"]); >+ is( $bibnumber_array->[0]->{index}->{_id},"13", "We should get a string matching the bibnumber"); >+}; >+ >-- >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 25342
:
104108
|
104175
|
104509
|
104685
|
104686