Lines 19-24
use C4::AuthoritiesMarc;
Link Here
|
19 |
use C4::Biblio; |
19 |
use C4::Biblio; |
20 |
use C4::Circulation; |
20 |
use C4::Circulation; |
21 |
use Koha::Database; |
21 |
use Koha::Database; |
|
|
22 |
use Koha::SearchEngine::Elasticsearch; |
22 |
use Koha::SearchEngine::Indexer; |
23 |
use Koha::SearchEngine::Indexer; |
23 |
|
24 |
|
24 |
use t::lib::TestBuilder; |
25 |
use t::lib::TestBuilder; |
Lines 58-70
subtest 'Test indexer object creation' => sub {
Link Here
|
58 |
}; |
59 |
}; |
59 |
|
60 |
|
60 |
subtest 'Test indexer calls' => sub { |
61 |
subtest 'Test indexer calls' => sub { |
61 |
plan tests => 24; |
62 |
plan tests => 32; |
62 |
|
63 |
|
63 |
my @engines = ('Zebra'); |
64 |
my @engines = ('Zebra'); |
64 |
eval { Koha::SearchEngine::Elasticsearch->get_elasticsearch_params; }; |
65 |
eval { Koha::SearchEngine::Elasticsearch->get_elasticsearch_params; }; |
65 |
push @engines, 'Elasticsearch' unless $@; |
66 |
push @engines, 'Elasticsearch' unless $@; |
66 |
SKIP: { |
67 |
SKIP: { |
67 |
skip 'Elasticsearch configuration not available', 12 |
68 |
skip 'Elasticsearch configuration not available', 16 |
68 |
if scalar @engines == 1; |
69 |
if scalar @engines == 1; |
69 |
} |
70 |
} |
70 |
|
71 |
|
Lines 74-79
subtest 'Test indexer calls' => sub {
Link Here
|
74 |
|
75 |
|
75 |
my $biblionumber1 = $builder->build_sample_biblio()->biblionumber; |
76 |
my $biblionumber1 = $builder->build_sample_biblio()->biblionumber; |
76 |
my $biblionumber2 = $builder->build_sample_biblio()->biblionumber; |
77 |
my $biblionumber2 = $builder->build_sample_biblio()->biblionumber; |
|
|
78 |
my $marcbiblio1 = GetMarcBiblio({biblionumber => $biblionumber1}); |
79 |
my $marcbiblio2 = GetMarcBiblio({biblionumber => $biblionumber2}); |
77 |
|
80 |
|
78 |
my $mock_zebra = Test::MockModule->new("Koha::SearchEngine::Zebra::Indexer"); |
81 |
my $mock_zebra = Test::MockModule->new("Koha::SearchEngine::Zebra::Indexer"); |
79 |
$mock_zebra->mock( ModZebra => sub { warn "ModZebra"; } ); |
82 |
$mock_zebra->mock( ModZebra => sub { warn "ModZebra"; } ); |
Lines 149-154
subtest 'Test indexer calls' => sub {
Link Here
|
149 |
DelBiblio( $biblio->biblionumber, { skip_record_index =>1 }); |
152 |
DelBiblio( $biblio->biblionumber, { skip_record_index =>1 }); |
150 |
} undef, "index_records is not called for $engine when calling DelBiblio if skip_record_index passed"; |
153 |
} undef, "index_records is not called for $engine when calling DelBiblio if skip_record_index passed"; |
151 |
|
154 |
|
|
|
155 |
warnings_are{ |
156 |
AddBiblio($marcbiblio1,""); |
157 |
} [$engine, "C4::Biblio"], "index_records is called for $engine when calling AddBiblio"; |
158 |
my $new_bib_num; |
159 |
warnings_are{ |
160 |
$new_bib_num = AddBiblio($marcbiblio2,"",{skip_record_index=>1}); |
161 |
} undef, "index_records is not called for $engine when calling AddBiblio if skip_record_index passed"; |
162 |
|
163 |
warnings_are{ |
164 |
ModBiblioMarc($marcbiblio2,$new_bib_num,""); |
165 |
} [$engine, "C4::Biblio"], "index_records is called for $engine when calling ModBiblioMarc"; |
166 |
warnings_are{ |
167 |
ModBiblioMarc($marcbiblio2,$new_bib_num,"",{skip_record_index=>1}); |
168 |
} undef, "index_records is not called for $engine when calling ModBiblioMarc if skip_record_index passed"; |
169 |
|
170 |
|
152 |
} |
171 |
} |
153 |
|
172 |
|
154 |
}; |
173 |
}; |
155 |
- |
|
|