Lines 20-34
foreach my $plugin (@installed_plugins) {
Link Here
|
20 |
ok(grep($plugin, @available_plugins), "Found plugin $plugin"); |
20 |
ok(grep($plugin, @available_plugins), "Found plugin $plugin"); |
21 |
} |
21 |
} |
22 |
|
22 |
|
23 |
my $suggestor = Koha::SuggestionEngine->new( { plugins => ( 'ABCD::EFGH::IJKL' ) } ); |
23 |
my $suggestor = Koha::SuggestionEngine->new( { plugins => [ 'ABCD::EFGH::IJKL' ] } ); |
24 |
|
24 |
|
25 |
is(ref($suggestor), 'Koha::SuggestionEngine', 'Created suggestion engine with invalid plugin'); |
25 |
is(ref($suggestor), 'Koha::SuggestionEngine', 'Created suggestion engine with invalid plugin'); |
26 |
is(scalar @{ $suggestor->get_suggestions({ 'search' => 'books' }) }, 0 , 'Request suggestions with empty suggestor'); |
26 |
is(scalar @{ $suggestor->get_suggestions({ 'search' => 'books' }) }, 0 , 'Request suggestions with empty suggestor'); |
27 |
|
27 |
|
28 |
$suggestor = Koha::SuggestionEngine->new( { plugins => ( 'Null' ) } ); |
28 |
$suggestor = Koha::SuggestionEngine->new( { plugins => [ 'Null' ] } ); |
29 |
is(ref($suggestor->plugins->[0]), 'Koha::SuggestionEngine::Plugin::Null', 'Created record suggestor with implicitly scoped Null filter'); |
29 |
is(ref($suggestor->plugins->[0]), 'Koha::SuggestionEngine::Plugin::Null', 'Created record suggestor with implicitly scoped Null filter'); |
30 |
|
30 |
|
31 |
$suggestor = Koha::SuggestionEngine->new( { plugins => ( 'Koha::SuggestionEngine::Plugin::Null' ) } ); |
31 |
$suggestor = Koha::SuggestionEngine->new( { plugins => [ 'Koha::SuggestionEngine::Plugin::Null' ] } ); |
32 |
is(ref($suggestor->plugins->[0]), 'Koha::SuggestionEngine::Plugin::Null', 'Created record suggestor with explicitly scoped Null filter'); |
32 |
is(ref($suggestor->plugins->[0]), 'Koha::SuggestionEngine::Plugin::Null', 'Created record suggestor with explicitly scoped Null filter'); |
33 |
|
33 |
|
34 |
my $suggestions = $suggestor->get_suggestions({ 'search' => 'books' }); |
34 |
my $suggestions = $suggestor->get_suggestions({ 'search' => 'books' }); |
Lines 38-44
is_deeply($suggestions->[0], { 'search' => 'book', label => 'Book!', relevance =
Link Here
|
38 |
$suggestions = $suggestor->get_suggestions({ 'search' => 'silliness' }); |
38 |
$suggestions = $suggestor->get_suggestions({ 'search' => 'silliness' }); |
39 |
|
39 |
|
40 |
eval { |
40 |
eval { |
41 |
$suggestor = Koha::SuggestionEngine->new( { plugins => ( 'Koha::SuggestionEngine::Plugin::Null' ) } ); |
41 |
$suggestor = Koha::SuggestionEngine->new( { plugins => [ 'Koha::SuggestionEngine::Plugin::Null' ] } ); |
42 |
undef $suggestor; |
42 |
undef $suggestor; |
43 |
}; |
43 |
}; |
44 |
ok(!$@, 'Destroyed suggestor successfully'); |
44 |
ok(!$@, 'Destroyed suggestor successfully'); |