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

(-)a/t/SuggestionEngine_ExplodedTerms.t (-1 / +59 lines)
Lines 3-14 Link Here
3
use strict;
3
use strict;
4
use warnings;
4
use warnings;
5
5
6
use File::Basename;
7
use File::Spec;
6
use Test::More;
8
use Test::More;
9
use Test::MockModule;
7
10
8
BEGIN {
11
BEGIN {
9
        use_ok('Koha::SuggestionEngine');
12
        use_ok('Koha::SuggestionEngine');
10
}
13
}
11
14
15
my $langModule = new Test::MockModule('C4::Languages');
16
$langModule->mock('regex_lang_subtags', sub {
17
    return {
18
        'extension' => undef,
19
        'script' => undef,
20
        'privateuse' => undef,
21
        'variant' => undef,
22
        'language' => 'en',
23
        'region' => undef,
24
        'rfc4646_subtag' => 'en'
25
    };
26
});
27
$langModule->mock('getTranslatedLanguages', sub {
28
   return [
29
       {
30
           'sublanguages_loop' => [
31
           {
32
               'script' => undef,
33
               'extension' => undef,
34
               'language' => 'en',
35
               'region' => undef,
36
               'region_description' => undef,
37
               'sublanguage_current' => 1,
38
               'privateuse' => undef,
39
               'variant' => undef,
40
               'variant_description' => undef,
41
               'script_description' => undef,
42
               'rfc4646_subtag' => 'en',
43
               'native_description' => 'English',
44
               'enabled' => 1
45
           },
46
           ],
47
           'plural' => 1,
48
           'language' => 'en',
49
           'current' => 1,
50
           'native_description' => 'English',
51
           'rfc4646_subtag' => 'en',
52
           'group_enabled' => 1
53
       }
54
   ];
55
});
56
my $tmplModule = new Test::MockModule('C4::Templates');
57
$tmplModule->mock('_get_template_file', sub {
58
    my ($tmplbase, $interface, $query) = @_;
59
    my $opactmpl = File::Spec->rel2abs(dirname(__FILE__) . '/../koha-tmpl/opac-tmpl');
60
    return ($opactmpl, 'prog', 'en', "$opactmpl/prog/en/modules/$tmplbase");
61
});
62
my $contextModule = new Test::MockModule('C4::Context');
63
$contextModule->mock('preference', sub {
64
    return '';
65
});
66
$contextModule->mock('config', sub {
67
    return '';
68
});
69
70
12
my $suggestor = Koha::SuggestionEngine->new( { plugins => [ 'ExplodedTerms' ] } );
71
my $suggestor = Koha::SuggestionEngine->new( { plugins => [ 'ExplodedTerms' ] } );
13
is(ref($suggestor), 'Koha::SuggestionEngine', 'Created suggestion engine');
72
is(ref($suggestor), 'Koha::SuggestionEngine', 'Created suggestion engine');
14
73
15
- 

Return to bug 8846