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

(-)a/t/db_dependent/Search.t (-7 / +50 lines)
Lines 1-14 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
2
#
9
#
3
# This Koha test module is a stub!
10
# Koha is distributed in the hope that it will be useful, but
4
# Add more tests here!!!
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
5
19
6
use strict;
7
use warnings;
8
use utf8;
20
use utf8;
9
21
10
use YAML;
22
use YAML;
11
23
24
use Data::Printer;
25
use C4::Items;
12
use C4::Debug;
26
use C4::Debug;
13
require C4::Context;
27
require C4::Context;
14
28
Lines 83-88 our $QueryWeightFields = 0; Link Here
83
our $QueryFuzzy = 0;
97
our $QueryFuzzy = 0;
84
our $QueryRemoveStopwords = 0;
98
our $QueryRemoveStopwords = 0;
85
our $UseQueryParser = 0;
99
our $UseQueryParser = 0;
100
our $DefaultClassificationSource = 'z';
101
our $CataloguingLog = 0;
102
our $dateformat = 'metric';
86
our $marcflavour = 'MARC21';
103
our $marcflavour = 'MARC21';
87
our $contextmodule = new Test::MockModule('C4::Context');
104
our $contextmodule = new Test::MockModule('C4::Context');
88
$contextmodule->mock('_new_dbh', sub {
105
$contextmodule->mock('_new_dbh', sub {
Lines 117-122 $contextmodule->mock('preference', sub { Link Here
117
        return '--';
134
        return '--';
118
    } elsif ($pref eq 'DisplayLibraryFacets') {
135
    } elsif ($pref eq 'DisplayLibraryFacets') {
119
        return 'holding';
136
        return 'holding';
137
    } elsif ($pref eq 'DefaultClassificationSource') {
138
        return $DefaultClassificationSource;
139
    } elsif ($pref eq 'dateformat') {
140
        return $dateformat;
141
    } elsif ($pref eq 'CataloguingLog') {
142
        return $CataloguingLog;
120
    } else {
143
    } else {
121
        warn "The syspref $pref was requested but I don't know what to say; this indicates that the test requires updating"
144
        warn "The syspref $pref was requested but I don't know what to say; this indicates that the test requires updating"
122
            unless $pref =~ m/(XSLT|item|branch|holding|image)/i;
145
            unless $pref =~ m/(XSLT|item|branch|holding|image)/i;
Lines 833-838 if ( $indexing_mode eq 'dom' ) { Link Here
833
    is($newresults[0]->{biblionumber}, '300', 'Over-large bib record has the correct biblionumber (bug 11096)');
856
    is($newresults[0]->{biblionumber}, '300', 'Over-large bib record has the correct biblionumber (bug 11096)');
834
    like($newresults[0]->{notes}, qr/This is large note #550/, 'Able to render the notes field for over-large bib record (bug 11096)');
857
    like($newresults[0]->{notes}, qr/This is large note #550/, 'Able to render the notes field for over-large bib record (bug 11096)');
835
858
859
    # notforloancount should be returned as part of searchResults output
860
    ok( defined $newresults[0]->{notforloancount},
861
        '\'notforloancount\' defined in searchResults output (Bug 12419)');
862
    is( $newresults[0]->{notforloancount}, 0,
863
        '\'notforloancount\' == 0 if no items attached (Bug 12419)');
864
    # Add an item to the biblio, with notforloan=1
865
    my ($item1_bibnum, $item1_bibitemnum, $item1_itemnumber) = AddItem(
866
            { homebranch => 'CPL',
867
              holdingbranch => 'CPL',
868
              dateaccessioned => '2014-06-18',
869
              notforloan => 1 },
870
            $newresults[0]->{ biblionumber }
871
    );
872
    # Call search results again
873
    @newresults = searchResults('opac', $query_desc,
874
        $results_hashref->{'biblioserver'}->{'hits'}, 10, 0, 0,
875
        $results_hashref->{'biblioserver'}->{"RECORDS"});
876
    # We should have notforloan
877
    is( $newresults[0]->{notforloancount}, 1,
878
        '\'notforloancount\' == 1 (Bug 12419)');
879
836
    # verify that we don't attempt to sort if no results were returned
880
    # verify that we don't attempt to sort if no results were returned
837
    # because of a query error
881
    # because of a query error
838
    warning_like {( undef, $results_hashref, $facets_loop ) =
882
    warning_like {( undef, $results_hashref, $facets_loop ) =
Lines 914-925 sub run_unimarc_search_tests { Link Here
914
}
958
}
915
959
916
subtest 'MARC21 + GRS-1' => sub {
960
subtest 'MARC21 + GRS-1' => sub {
917
    plan tests => 104;
961
    plan tests => 105;
918
    run_marc21_search_tests('grs1');
962
    run_marc21_search_tests('grs1');
919
};
963
};
920
964
921
subtest 'MARC21 + DOM' => sub {
965
subtest 'MARC21 + DOM' => sub {
922
    plan tests => 104;
966
    plan tests => 105;
923
    run_marc21_search_tests('dom');
967
    run_marc21_search_tests('dom');
924
};
968
};
925
969
926
- 

Return to bug 12419