Bugzilla – Attachment 18302 Details for
Bug 10298
t::lib::Mocks tries to deal with syspref but doesn not manage to
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10298: Adapt existing code
Bug-10298-Adapt-existing-code.patch (text/plain), 5.10 KB, created by
Jonathan Druart
on 2013-05-22 09:07:50 UTC
(
hide
)
Description:
Bug 10298: Adapt existing code
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-05-22 09:07:50 UTC
Size:
5.10 KB
patch
obsolete
>From 1b2de60000f52a3eeac7da99ac7e01d2de82f4fc Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Tue, 21 May 2013 17:14:24 +0200 >Subject: [PATCH] Bug 10298: Adapt existing code > >set_solr and set_zebra is not really useful. It is preferable to use >mock_preference directly. > >To test: >1/ Launch Solr >2/ prove -r t/searchengine/ >It should produce: >% prove -r t/searchengine/ >t/searchengine/000_conn/conn.t ........... ok >t/searchengine/001_search/search_base.t .. ok >t/searchengine/002_index/index_base.t .... IndexRecord called with biblio 2 >Indexing biblio 2 >t/searchengine/002_index/index_base.t .... ok >t/searchengine/003_query/buildquery.t .... ok >t/searchengine/004_config/load_config.t .. ok >All tests successful. >Files=5, Tests=21, 4 wallclock secs ( 0.03 usr 0.01 sys + 2.74 cusr >0.20 csys = 2.98 CPU) >Result: PASS >--- > t/searchengine/000_conn/conn.t | 16 ++++++++-------- > t/searchengine/001_search/search_base.t | 2 +- > t/searchengine/002_index/index_base.t | 2 +- > t/searchengine/003_query/buildquery.t | 5 ++--- > t/searchengine/004_config/load_config.t | 3 +-- > 5 files changed, 13 insertions(+), 15 deletions(-) > >diff --git a/t/searchengine/000_conn/conn.t b/t/searchengine/000_conn/conn.t >index 8510269..fa08d7a 100644 >--- a/t/searchengine/000_conn/conn.t >+++ b/t/searchengine/000_conn/conn.t >@@ -1,23 +1,23 @@ > use Modern::Perl; > use Test::More; > use Koha::SearchEngine::Solr; >-use Koha::SearchEngine::Zebra; >+#use Koha::SearchEngine::Zebra; > use Koha::SearchEngine::Search; >-use t::lib::Mocks; >+use t::lib::Mocks qw( mock_preference ); > > my $se_index = Koha::SearchEngine::Solr->new; > ok($se_index->isa('Data::SearchEngine::Solr'), 'Solr is a Solr data searchengine'); > >-$se_index = Koha::SearchEngine::Zebra->new; >-ok($se_index->isa('Data::SearchEngine::Zebra'), 'Zebra search engine'); >+#$se_index = Koha::SearchEngine::Zebra->new; >+#ok($se_index->isa('Data::SearchEngine::Zebra'), 'Zebra search engine'); > >-set_solr(); >+t::lib::Mocks::mock_preference('SearchEngine', 'Solr'); > $se_index = Koha::SearchEngine::Search->new; > ok($se_index->searchengine->isa('Data::SearchEngine::Solr'), 'Solr search engine'); > >-set_zebra(); >-$se_index = Koha::SearchEngine::Search->new; >-ok($se_index->searchengine->isa('Data::SearchEngine::Zebra'), 'Zebra search engine'); >+#t::lib::Mocks::mock_preference('SearchEngine', 'Zebra'); >+#$se_index = Koha::SearchEngine::Search->new; >+#ok($se_index->searchengine->isa('Data::SearchEngine::Zebra'), 'Zebra search engine'); > > > done_testing; >diff --git a/t/searchengine/001_search/search_base.t b/t/searchengine/001_search/search_base.t >index 8351b17..f567ab2 100755 >--- a/t/searchengine/001_search/search_base.t >+++ b/t/searchengine/001_search/search_base.t >@@ -2,7 +2,7 @@ use Test::More; > > use t::lib::Mocks; > >-set_solr; >+t::lib::Mocks::mock_preference('SearchEngine', 'Solr'); > use Koha::SearchEngine::Search; > my $search_service = Koha::SearchEngine::Search->new; > isnt (scalar $search_service->search("fort"), 0, 'test search') ; >diff --git a/t/searchengine/002_index/index_base.t b/t/searchengine/002_index/index_base.t >index 7f86bb8..ff0435a 100755 >--- a/t/searchengine/002_index/index_base.t >+++ b/t/searchengine/002_index/index_base.t >@@ -5,7 +5,7 @@ use t::lib::::Mocks; > > use Koha::SearchEngine::Index; > >-set_solr; >+t::lib::Mocks::mock_preference('SearchEngine', 'Solr'); > my $index_service = Koha::SearchEngine::Index->new; > system( qq{/bin/cp $FindBin::Bin/../indexes.yaml /tmp/indexes.yaml} ); > $index_service->searchengine->config->set_config_filename( "/tmp/indexes.yaml" ); >diff --git a/t/searchengine/003_query/buildquery.t b/t/searchengine/003_query/buildquery.t >index 008e1e1..d334b11 100644 >--- a/t/searchengine/003_query/buildquery.t >+++ b/t/searchengine/003_query/buildquery.t >@@ -19,7 +19,7 @@ my ($operands, $indexes, $operators); > @$indexes = ('ti', 'au'); > @$operators = ('AND'); > >-set_solr; >+t::lib::Mocks::mock_preference('SearchEngine', 'Solr'); > my $qs = Koha::SearchEngine::QueryBuilder->new; > > my $se = Koha::SearchEngine->new; >@@ -31,7 +31,7 @@ is($gotsolr, $expectedsolr, "Test build_query Solr"); > > > # === Zebra part === >-set_zebra; >+t::lib::Mocks::mock_preference('SearchEngine', 'Zebra'); > $se = Koha::SearchEngine->new; > is( $se->name, "Zebra", "Test searchengine name eq Zebra" ); > $qs = Koha::SearchEngine::QueryBuilder->new; >@@ -39,7 +39,6 @@ my ( $builterror, $builtquery, $simple_query, $query_cgi, $query_desc, $limit, $ > my $gotzebra = $builtquery; > my $expectedzebra = qq{ti,wrdl= cup AND au,wrdl= rowling }; > is($gotzebra, $expectedzebra, "Test Zebra indexes in 'normal' search"); >-# @and @attr 1=title @attr 4=6 "des mots de mon titre" @attr 1=author Jean en PQF > > > done_testing; >diff --git a/t/searchengine/004_config/load_config.t b/t/searchengine/004_config/load_config.t >index 4e3665d..b53cf53 100644 >--- a/t/searchengine/004_config/load_config.t >+++ b/t/searchengine/004_config/load_config.t >@@ -6,8 +6,7 @@ use C4::Context; > use Koha::SearchEngine; > use t::lib::Mocks; > >-set_solr; >- >+t::lib::Mocks::mock_preference('SearchEngine', 'Solr'); > my $se = Koha::SearchEngine->new; > is( $se->name, "Solr", "Test searchengine name eq Solr" ); > >-- >1.7.10.4
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 10298
:
18301
|
18302
|
18376
|
18504
|
19009
|
19010
|
19011
|
20206
|
20207
|
20232
|
20233
|
20234