Bugzilla – Attachment 44161 Details for
Bug 15082
t/db_dependent/Search.t shouldn't mock the DB connection
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 15082: t/db_dependent/Search.t shouldn't mock the DB connection
SIGNED-OFF-Bug-15082-tdbdependentSearcht-shouldnt-.patch (text/plain), 2.94 KB, created by
Bernardo Gonzalez Kriegel
on 2015-10-29 15:34:46 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 15082: t/db_dependent/Search.t shouldn't mock the DB connection
Filename:
MIME Type:
Creator:
Bernardo Gonzalez Kriegel
Created:
2015-10-29 15:34:46 UTC
Size:
2.94 KB
patch
obsolete
>From dee60a483f53bebac1f404d6bfd545d167157efb Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 29 Oct 2015 11:20:06 -0300 >Subject: [PATCH] [SIGNED-OFF] Bug 15082: t/db_dependent/Search.t shouldn't > mock the DB connection > >This patch makes the t/db_dependent/Search.t tests use a real DB instead of >mocking the DB handler (which is not actually used and generates unnecesary >warnings when running the tests). > >It does so by grabbing the DB configuration data using C4::Context->config() >and passing it (writing %ENV) to rewrite-config.PL, all is done in zebra_config.pl >which is only used on the Search.t file. > >To test: >- Run > $ prove t/db_dependent/Search.t >=> FAIL: Warnings are raised about DB being mocked and DBIC not recognising 'Mock' > as a valid DB driver. >- Apply the patch >- Run > $ prove r/db_dependent/Search.t >=> SUCCESS: Same tests results, no warning about DBIC driver. >- Sign off :-D > >Disclamer: As of writing this patch, the Search.t tests pass. The patch is not dealing >with tests results, but how they use the DB. > >Sponsored-by: Universidad Nacional de Cordoba > >Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> >Test pass before & after, a 'little' less noisy >No errors >--- > t/db_dependent/Search.t | 5 ----- > t/db_dependent/zebra_config.pl | 10 ++++++++++ > 2 files changed, 10 insertions(+), 5 deletions(-) > >diff --git a/t/db_dependent/Search.t b/t/db_dependent/Search.t >index 904e8b8..cac37e8 100644 >--- a/t/db_dependent/Search.t >+++ b/t/db_dependent/Search.t >@@ -37,8 +37,6 @@ use Test::Warn; > use File::Temp qw/ tempdir /; > use File::Path; > >-use t::lib::Mocks; >- > our $child; > our $datadir; > >@@ -84,9 +82,6 @@ sub cleanup { > } > } > >-BEGIN { >- t::lib::Mocks::mock_dbh; >-} > # Fall back to make sure that the Zebra process > # and files get cleaned up > END { >diff --git a/t/db_dependent/zebra_config.pl b/t/db_dependent/zebra_config.pl >index 75efb7b..55fedf4 100755 >--- a/t/db_dependent/zebra_config.pl >+++ b/t/db_dependent/zebra_config.pl >@@ -1,12 +1,15 @@ > #!/usr/bin/perl > > use Modern::Perl; >+ > use File::Copy; > use File::Path qw(make_path); > use File::Find; > use File::Basename; > use File::Spec; > >+use C4::Context; >+ > my $source = File::Spec->rel2abs('.'); > my $destination = $ARGV[0]; > my $marc_type = $ARGV[1] || 'marc21'; >@@ -48,6 +51,13 @@ make_path("$destination/var/run/zebradb"); > $ENV{'INSTALL_BASE'} = $destination; > $ENV{'__INSTALL_BASE__'} = $destination; > >+$ENV{'__DB_TYPE__'} = C4::Context->config('db_scheme') // 'mysql'; >+$ENV{'__DB_NAME__'} = C4::Context->config('database') // 'koha'; >+$ENV{'__DB_HOST__'} = C4::Context->config('hostname') // 'localhost'; >+$ENV{'__DB_PORT__'} = C4::Context->config('port') // '3306'; >+$ENV{'__DB_USER__'} = C4::Context->config('user') // 'kohaadmin'; >+$ENV{'__DB_PASS__'} = C4::Context->config('pass') // 'katikoan'; >+ > my @files = ( "$source/etc/koha-conf.xml", > "$source/etc/searchengine/queryparser.yaml", > ); >-- >1.9.1
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 15082
:
44153
|
44161
|
44169