View | Details | Raw Unified | Return to bug 34970
Collapse All | Expand All

(-)a/t/SuggestionEngine_AuthorityFile.t (-26 / +2 lines)
Lines 20-49 Link Here
20
# for every call to SearchAuthorities
20
# for every call to SearchAuthorities
21
21
22
use Modern::Perl;
22
use Modern::Perl;
23
23
use Test::More tests => 2;
24
use File::Spec;
25
use MARC::Record;
26
27
use Test::More;
28
use Test::MockModule;
24
use Test::MockModule;
29
use t::lib::Mocks;
30
31
use Module::Load::Conditional qw/check_install/;
32
33
BEGIN {
34
    if ( check_install( module => 'Test::DBIx::Class' ) ) {
35
        plan tests => 3;
36
    } else {
37
        plan skip_all => "Need Test::DBIx::Class"
38
    }
39
}
40
25
41
# Mock the DB connexion
26
use Koha::SuggestionEngine;
42
use Test::DBIx::Class;
43
my $db = Test::MockModule->new('Koha::Database');
44
$db->mock( _new_schema => sub { return Schema(); } );
45
46
use_ok('Koha::SuggestionEngine');
47
27
48
my $module = Test::MockModule->new('C4::AuthoritiesMarc');
28
my $module = Test::MockModule->new('C4::AuthoritiesMarc');
49
$module->mock('SearchAuthorities', sub {
29
$module->mock('SearchAuthorities', sub {
Lines 68-73 is(ref($suggestor), 'Koha::SuggestionEngine', 'Created suggestion engine'); Link Here
68
my $result = $suggestor->get_suggestions({search => 'Cookery'});
48
my $result = $suggestor->get_suggestions({search => 'Cookery'});
69
49
70
is_deeply($result, [ { 'search' => 'an:1234', 'relevance' => 1, 'label' => 'Cooking' } ], "Suggested correct alternative to 'Cookery'");
50
is_deeply($result, [ { 'search' => 'an:1234', 'relevance' => 1, 'label' => 'Cooking' } ], "Suggested correct alternative to 'Cookery'");
71
72
done_testing();
73
74
- 

Return to bug 34970