Bugzilla – Attachment 33697 Details for
Bug 13278
t/Search.t shouldn't depend on the DB
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 13278: t/Search.t shouldn't depend on the DB
PASSED-QA-Bug-13278-tSearcht-shouldnt-depend-on-th.patch (text/plain), 1.56 KB, created by
Katrin Fischer
on 2014-11-19 20:00:02 UTC
(
hide
)
Description:
[PASSED QA] Bug 13278: t/Search.t shouldn't depend on the DB
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2014-11-19 20:00:02 UTC
Size:
1.56 KB
patch
obsolete
>From 05e902eb83c4d8614ff7cb707a7bf3c4aa2f83bf Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@gmail.com> >Date: Tue, 18 Nov 2014 01:05:30 -0300 >Subject: [PATCH] [PASSED QA] Bug 13278: t/Search.t shouldn't depend on the DB > >To reproduce: >- Stop your MySQL server: > $ sudo service mysql stop >- Run > $ prove t/Search.t >=> FAIL: some tests fail because of mysql stopped > >To test (MySQL still stopped) >- Apply the patch >- Run > $ prove t/Search.t >=> SUCCESS: tests pass because the ycan be loaded regardless of > the absence of the DB server >- Sign off :-D > >Regards > >Signed-off-by: Magnus Enger <digitalutvikling@gmail.com> >Turned off MySQL and ran the tests before and after the patch. >Works as advertised. > >Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> >--- > t/Search.t | 20 ++++++++++++++------ > 1 file changed, 14 insertions(+), 6 deletions(-) > >diff --git a/t/Search.t b/t/Search.t >index 286d36a..69ed79f 100755 >--- a/t/Search.t >+++ b/t/Search.t >@@ -18,12 +18,20 @@ > use Modern::Perl; > > use Test::More tests => 3; >- >-BEGIN { >- use_ok('C4::Search'); >- can_ok('C4::Search', >- qw/_build_initial_query/); >-} >+use Test::MockModule; >+use DBD::Mock; >+ >+# Mock the DB connexion and C4::Context >+my $context = new Test::MockModule('C4::Context'); >+$context->mock( '_new_dbh', sub { >+ my $dbh = DBI->connect( 'DBI:Mock:', '', '' ) >+ || die "Cannot create handle: $DBI::errstr\n"; >+ return $dbh; >+}); >+ >+use_ok('C4::Search'); >+can_ok('C4::Search', >+ qw/_build_initial_query/); > > subtest "_build_initial_query tests" => sub { > >-- >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 13278
:
33635
|
33642
| 33697 |
33713