Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 2; |
20 |
use Test::More tests => 3; |
21 |
use Test::MockModule; |
21 |
use Test::MockModule; |
22 |
use t::lib::Mocks; |
22 |
use t::lib::Mocks; |
23 |
|
23 |
|
Lines 70-72
subtest 'create_index() tests' => sub {
Link Here
|
70 |
'Dropping the index' |
70 |
'Dropping the index' |
71 |
); |
71 |
); |
72 |
}; |
72 |
}; |
73 |
- |
73 |
|
|
|
74 |
|
75 |
subtest 'update_index() tests' => sub { |
76 |
plan tests => 2; |
77 |
my $kse = Test::MockModule->new( 'Koha::SearchEngine::Elasticsearch' ); |
78 |
$kse->mock( 'marc_records_to_documents', sub { |
79 |
my ($self, $params ) = @_; |
80 |
return [1]; |
81 |
}); |
82 |
|
83 |
my $indexer; |
84 |
ok( |
85 |
$indexer = Koha::SearchEngine::Elasticsearch::Indexer->new({ 'index' => 'biblios' }), |
86 |
'Creating a new indexer object' |
87 |
); |
88 |
|
89 |
my $searcher = $indexer->get_elasticsearch(); |
90 |
my $se = Test::MockModule->new( ref $searcher ); |
91 |
$se->mock( 'bulk', sub { |
92 |
my ($self, %params ) = @_; |
93 |
return $params{body}; |
94 |
}); |
95 |
|
96 |
my $bibnumber_array = $indexer->update_index([13],["faked"]); |
97 |
is( $bibnumber_array->[0]->{index}->{_id},"13", "We should get a string matching the bibnumber"); |
98 |
}; |
99 |
|