Bugzilla – Attachment 11928 Details for
Bug 8649
C4::Search needs a unit test
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] bug 8649: make sure C4::Context is fully mocked-up before tests
bug-8649-make-sure-C4Context-is-fully-mocked-up-be.patch (text/plain), 2.97 KB, created by
Kyle M Hall (khall)
on 2012-08-31 18:20:43 UTC
(
hide
)
Description:
[SIGNED-OFF] bug 8649: make sure C4::Context is fully mocked-up before tests
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2012-08-31 18:20:43 UTC
Size:
2.97 KB
patch
obsolete
>From 2e6c5cbcb0ec2be6870445e9c315c154a35c6e66 Mon Sep 17 00:00:00 2001 >From: Galen Charlton <gmc@esilibrary.com> >Date: Thu, 16 Aug 2012 13:04:00 -0400 >Subject: [PATCH] bug 8649: make sure C4::Context is fully mocked-up before tests >Content-Type: text/plain; charset="utf-8" > >This fixes failures of the test cases to run for me >on Perl 5.10.1 using prove -v t/db_dependent/Search.t > >Signed-off-by: Galen Charlton <gmc@esilibrary.com> >Signed-off-by: wajasu <matted-34813@mypacks.net> >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > t/db_dependent/Search.t | 43 +++++++++++++++++++++---------------------- > 1 files changed, 21 insertions(+), 22 deletions(-) > >diff --git a/t/db_dependent/Search.t b/t/db_dependent/Search.t >index e6f9dfa..242f259 100644 >--- a/t/db_dependent/Search.t >+++ b/t/db_dependent/Search.t >@@ -10,7 +10,7 @@ use utf8; > use YAML; > > use C4::Debug; >-use C4::Context; >+require C4::Context; > > use Test::More tests => 57; > use Test::MockModule; >@@ -21,26 +21,8 @@ use File::Find; > use Test::Warn; > > system(dirname(__FILE__) . "/zebra_config.pl"); >- > my $datadir = dirname(__FILE__) . "/data"; > >-use_ok('C4::Search'); >- >-foreach my $string ("Leçon","modèles") { >- my @results=C4::Search::_remove_stopwords($string,"kw"); >- $debug && warn "$string ",Dump(@results); >- ok($results[0] eq $string,"$string is not modified"); >-} >- >-foreach my $string ("A book about the stars") { >- my @results=C4::Search::_remove_stopwords($string,"kw"); >- $debug && warn "$string ",Dump(@results); >- ok($results[0] ne $string,"$results[0] from $string"); >-} >- >-my $indexes = C4::Search::getIndexes(); >-is(scalar(grep(/^ti$/, @$indexes)), 1, "Title index supported"); >- > my $QueryStemming = 0; > my $QueryAutoTruncate = 0; > my $QueryWeightFields = 0; >@@ -123,6 +105,26 @@ $contextmodule->mock('marcfromkohafield', sub { > ); > return \%hash; > }); >+my $context = new C4::Context("$datadir/etc/koha-conf.xml"); >+$context->set_context(); >+ >+use_ok('C4::Search'); >+ >+foreach my $string ("Leçon","modèles") { >+ my @results=C4::Search::_remove_stopwords($string,"kw"); >+ $debug && warn "$string ",Dump(@results); >+ ok($results[0] eq $string,"$string is not modified"); >+} >+ >+foreach my $string ("A book about the stars") { >+ my @results=C4::Search::_remove_stopwords($string,"kw"); >+ $debug && warn "$string ",Dump(@results); >+ ok($results[0] ne $string,"$results[0] from $string"); >+} >+ >+my $indexes = C4::Search::getIndexes(); >+is(scalar(grep(/^ti$/, @$indexes)), 1, "Title index supported"); >+ > my $bibliomodule = new Test::MockModule('C4::Biblio'); > $bibliomodule->mock('_get_inverted_marc_field_map', sub { > my %hash = ( >@@ -225,9 +227,6 @@ $record->add_fields( > ($biblionumber,undef,$title) = FindDuplicate($record); > is($biblionumber, 203, 'Found duplicate with author/title'); > >-my $context = new C4::Context("$datadir/etc/koha-conf.xml"); >-$context->set_context(); >- > # Testing SimpleSearch > > my ( $error, $marcresults, $total_hits ) = SimpleSearch("book", 0, 9); >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 8649
:
11642
|
11648
|
11649
|
11650
|
11651
|
11652
|
11925
|
11926
|
11927
| 11928 |
11929
|
11930
|
11931
|
11932