Bug 34970: Remove most modules from SuggestionEngine_AuthorityFile.t

There is really no need for all those modules here.
What remains, is just a trivial test.

Test plan:
Run t/SuggestionEngine_AuthorityFile.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 80db256a47)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 5fd2fe48b9)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
This commit is contained in:
Marcel de Rooy 2023-09-30 06:58:23 +00:00 committed by Matt Blenkinsop
parent 8d10a8ca3d
commit 11a64807e6

View file

@ -20,30 +20,10 @@
# for every call to SearchAuthorities # for every call to SearchAuthorities
use Modern::Perl; use Modern::Perl;
use Test::More tests => 2;
use File::Spec;
use MARC::Record;
use Test::More;
use Test::MockModule; use Test::MockModule;
use t::lib::Mocks;
use Module::Load::Conditional qw/check_install/; use Koha::SuggestionEngine;
BEGIN {
if ( check_install( module => 'Test::DBIx::Class' ) ) {
plan tests => 3;
} else {
plan skip_all => "Need Test::DBIx::Class"
}
}
# Mock the DB connexion
use Test::DBIx::Class;
my $db = Test::MockModule->new('Koha::Database');
$db->mock( _new_schema => sub { return Schema(); } );
use_ok('Koha::SuggestionEngine');
my $module = Test::MockModule->new('C4::AuthoritiesMarc'); my $module = Test::MockModule->new('C4::AuthoritiesMarc');
$module->mock('SearchAuthorities', sub { $module->mock('SearchAuthorities', sub {
@ -68,6 +48,3 @@ is(ref($suggestor), 'Koha::SuggestionEngine', 'Created suggestion engine');
my $result = $suggestor->get_suggestions({search => 'Cookery'}); my $result = $suggestor->get_suggestions({search => 'Cookery'});
is_deeply($result, [ { 'search' => 'an:1234', 'relevance' => 1, 'label' => 'Cooking' } ], "Suggested correct alternative to 'Cookery'"); is_deeply($result, [ { 'search' => 'an:1234', 'relevance' => 1, 'label' => 'Cooking' } ], "Suggested correct alternative to 'Cookery'");
done_testing();