52f54eec1d
Fixes several perlcritic complaints, and some overflow in the configuration page. Also notes that Did You Mean is not yet enabled on the staff client. Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com> Sorry about the problematic last attempt at uploading. I missed a patch when squashing. It is now included.
31 lines
1.1 KiB
Perl
Executable file
31 lines
1.1 KiB
Perl
Executable file
#!/usr/bin/perl
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
use Test::More;
|
|
|
|
BEGIN {
|
|
use_ok('Koha::SuggestionEngine');
|
|
}
|
|
|
|
my $suggestor = Koha::SuggestionEngine->new( { plugins => [ 'ExplodedTerms' ] } );
|
|
is(ref($suggestor), 'Koha::SuggestionEngine', 'Created suggestion engine');
|
|
|
|
my $result = $suggestor->get_suggestions({search => 'Cookery'});
|
|
|
|
ok((grep { $_->{'search'} eq 'su-na=Cookery' } @$result) && (grep { $_->{'search'} eq 'su-br=Cookery' } @$result) && (grep { $_->{'search'} eq 'su-rl=Cookery' } @$result), "Suggested correct alternatives for keyword search 'Cookery'");
|
|
|
|
$result = $suggestor->get_suggestions({search => 'su:Cookery'});
|
|
|
|
ok((grep { $_->{'search'} eq 'su-na=Cookery' } @$result) && (grep { $_->{'search'} eq 'su-br=Cookery' } @$result) && (grep { $_->{'search'} eq 'su-rl=Cookery' } @$result), "Suggested correct alternatives for subject search 'Cookery'");
|
|
|
|
$result = $suggestor->get_suggestions({search => 'nt:Cookery'});
|
|
|
|
is(scalar @$result, 0, "No suggestions for fielded search");
|
|
|
|
$result = $suggestor->get_suggestions({search => 'ccl=su:Cookery'});
|
|
|
|
is(scalar @$result, 0, "No suggestions for CCL search");
|
|
|
|
done_testing();
|