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

(-)a/t/db_dependent/Search.t (-23 / +21 lines)
Lines 10-16 use utf8; Link Here
10
use YAML;
10
use YAML;
11
11
12
use C4::Debug;
12
use C4::Debug;
13
use C4::Context;
13
require C4::Context;
14
14
15
use Test::More tests => 57;
15
use Test::More tests => 57;
16
use Test::MockModule;
16
use Test::MockModule;
Lines 21-46 use File::Find; Link Here
21
use Test::Warn;
21
use Test::Warn;
22
22
23
system(dirname(__FILE__) . "/zebra_config.pl");
23
system(dirname(__FILE__) . "/zebra_config.pl");
24
25
my $datadir = dirname(__FILE__) . "/data";
24
my $datadir = dirname(__FILE__) . "/data";
26
25
27
use_ok('C4::Search');
28
29
foreach my $string ("Leçon","modèles") {
30
    my @results=C4::Search::_remove_stopwords($string,"kw");
31
    $debug && warn "$string ",Dump(@results);
32
    ok($results[0] eq $string,"$string is not modified");
33
}
34
35
foreach my $string ("A book about the stars") {
36
    my @results=C4::Search::_remove_stopwords($string,"kw");
37
    $debug && warn "$string ",Dump(@results);
38
    ok($results[0] ne $string,"$results[0] from $string");
39
}
40
41
my $indexes = C4::Search::getIndexes();
42
is(scalar(grep(/^ti$/, @$indexes)), 1, "Title index supported");
43
44
my $QueryStemming = 0;
26
my $QueryStemming = 0;
45
my $QueryAutoTruncate = 0;
27
my $QueryAutoTruncate = 0;
46
my $QueryWeightFields = 0;
28
my $QueryWeightFields = 0;
Lines 123-128 $contextmodule->mock('marcfromkohafield', sub { Link Here
123
        );
105
        );
124
        return \%hash;
106
        return \%hash;
125
});
107
});
108
my $context = new C4::Context("$datadir/etc/koha-conf.xml");
109
$context->set_context();
110
111
use_ok('C4::Search');
112
113
foreach my $string ("Leçon","modèles") {
114
    my @results=C4::Search::_remove_stopwords($string,"kw");
115
    $debug && warn "$string ",Dump(@results);
116
    ok($results[0] eq $string,"$string is not modified");
117
}
118
119
foreach my $string ("A book about the stars") {
120
    my @results=C4::Search::_remove_stopwords($string,"kw");
121
    $debug && warn "$string ",Dump(@results);
122
    ok($results[0] ne $string,"$results[0] from $string");
123
}
124
125
my $indexes = C4::Search::getIndexes();
126
is(scalar(grep(/^ti$/, @$indexes)), 1, "Title index supported");
127
126
my $bibliomodule = new Test::MockModule('C4::Biblio');
128
my $bibliomodule = new Test::MockModule('C4::Biblio');
127
$bibliomodule->mock('_get_inverted_marc_field_map', sub {
129
$bibliomodule->mock('_get_inverted_marc_field_map', sub {
128
    my %hash = (
130
    my %hash = (
Lines 225-233 $record->add_fields( Link Here
225
($biblionumber,undef,$title) = FindDuplicate($record);
227
($biblionumber,undef,$title) = FindDuplicate($record);
226
is($biblionumber, 203, 'Found duplicate with author/title');
228
is($biblionumber, 203, 'Found duplicate with author/title');
227
229
228
my $context = new C4::Context("$datadir/etc/koha-conf.xml");
229
$context->set_context();
230
231
# Testing SimpleSearch
230
# Testing SimpleSearch
232
231
233
my ( $error, $marcresults, $total_hits ) = SimpleSearch("book", 0, 9);
232
my ( $error, $marcresults, $total_hits ) = SimpleSearch("book", 0, 9);
234
- 

Return to bug 8649