From 4132ac28bf088960d25766fccc60ba1535a0e8ef Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 30 Jun 2014 14:55:04 -0300 Subject: [PATCH] Bug 12419: (QA followup) regression tests Changes to searchResults deserve unit tests. Edit: minor tweaks: - Remove warning in line 702 - Modernize - License added - "This file is a stub" removed Signed-off-by: Tomas Cohen Arazi --- t/db_dependent/Search.t | 32 +++++++++++++++++----- .../large_biblio_dom/exported_records.xml | 12 ++++++++ .../large_biblio_grs1/exported_records.xml | 12 ++++++++ 3 files changed, 49 insertions(+), 7 deletions(-) diff --git a/t/db_dependent/Search.t b/t/db_dependent/Search.t index 46d63f41a4..cadfedb72d 100644 --- a/t/db_dependent/Search.t +++ b/t/db_dependent/Search.t @@ -1,10 +1,22 @@ #!/usr/bin/perl + +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# This Koha test module is a stub! -# Add more tests here!!! +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . + +use Modern::Perl; -use strict; -use warnings; use utf8; use YAML; @@ -675,7 +687,7 @@ if ( $indexing_mode eq 'dom' ) { # make one of the test items appear to be in transit my $circ_module = new Test::MockModule('C4::Circulation'); $circ_module->mock('GetTransfers', sub { - my $itemnumber = shift; + my $itemnumber = shift // -1; if ($itemnumber == 11) { return ('2013-07-19', 'MPL', 'CPL'); } else { @@ -833,6 +845,12 @@ if ( $indexing_mode eq 'dom' ) { is($newresults[0]->{biblionumber}, '300', 'Over-large bib record has the correct biblionumber (bug 11096)'); like($newresults[0]->{notes}, qr/This is large note #550/, 'Able to render the notes field for over-large bib record (bug 11096)'); + # notforloancount should be returned as part of searchResults output + ok( defined $newresults[0]->{notforloancount}, + '\'notforloancount\' defined in searchResults output (Bug 12419)'); + is( $newresults[0]->{notforloancount}, 2, + '\'notforloancount\' == 2 (Bug 12419)'); + # verify that we don't attempt to sort if no results were returned # because of a query error warning_like {( undef, $results_hashref, $facets_loop ) = @@ -914,12 +932,12 @@ sub run_unimarc_search_tests { } subtest 'MARC21 + GRS-1' => sub { - plan tests => 104; + plan tests => 106; run_marc21_search_tests('grs1'); }; subtest 'MARC21 + DOM' => sub { - plan tests => 104; + plan tests => 106; run_marc21_search_tests('dom'); }; diff --git a/t/db_dependent/data/marc21/zebraexport/large_biblio_dom/exported_records.xml b/t/db_dependent/data/marc21/zebraexport/large_biblio_dom/exported_records.xml index 36c8efa222..4a58f8678e 100644 --- a/t/db_dependent/data/marc21/zebraexport/large_biblio_dom/exported_records.xml +++ b/t/db_dependent/data/marc21/zebraexport/large_biblio_dom/exported_records.xml @@ -1659,6 +1659,18 @@ This is a note. This is a large note. This is note that is so large, the margins of this terminal window are not nearly wide enough to contain it. This is large note #550 + + aaabbb + 1 + + + bbbccc + 0 + + + cccddd + 1 + 300 300 diff --git a/t/db_dependent/data/marc21/zebraexport/large_biblio_grs1/exported_records.xml b/t/db_dependent/data/marc21/zebraexport/large_biblio_grs1/exported_records.xml index 4305f7d55c..21cfa1738c 100644 --- a/t/db_dependent/data/marc21/zebraexport/large_biblio_grs1/exported_records.xml +++ b/t/db_dependent/data/marc21/zebraexport/large_biblio_grs1/exported_records.xml @@ -1658,6 +1658,18 @@ This is a note. This is a large note. This is note that is so large, the margins of this terminal window are not nearly wide enough to contain it. This is large note #550 + + aaabbb + 1 + + + bbbccc + 0 + + + cccddd + 1 + 300 300 -- 2.11.0