Bugzilla – Attachment 33446 Details for
Bug 13230
Bug 12995 causes test case failures
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13230: t/Biblio.t should run without a DB
Bug-13230-tBibliot-should-run-without-a-DB.patch (text/plain), 1.48 KB, created by
Tomás Cohen Arazi (tcohen)
on 2014-11-11 03:07:19 UTC
(
hide
)
Description:
Bug 13230: t/Biblio.t should run without a DB
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2014-11-11 03:07:19 UTC
Size:
1.48 KB
patch
obsolete
>From d925575f2dbee65e8b842bf13a2bfdcc40fc9173 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@gmail.com> >Date: Mon, 10 Nov 2014 23:59:36 -0300 >Subject: [PATCH] Bug 13230: t/Biblio.t should run without a DB > >This patch makes t/Biblio.t mock the DB connexion setting >a void one. All tests in this file currently call the C4::Biblio >functions with invalid (absent) parameters, so they are expected to >raise warnings and return undef values. > >If someone writes mocked tests for the rest of the functionality, >it is expected to mock the DB calls to match the desired scenario. > >To test: >- Turn of MySQL >- Run > $ prove t/Biblio.t >=> FAIL: Tests fail because of missing MySQL server >- Apply the patch >- Run > $ prove t/Biblio.t >=> SUCCESS: Tests now pass >- Start MySQL >- Run > $ prove t/Biblio.t >=> SUCCESS: Tests still pass >- Sign off > >Regards >Tomas > >Sponsored-by: The will to procrastinate >--- > t/Biblio.t | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > >diff --git a/t/Biblio.t b/t/Biblio.t >index 67f752d..cec30a9 100755 >--- a/t/Biblio.t >+++ b/t/Biblio.t >@@ -18,12 +18,24 @@ > use Modern::Perl; > > use Test::More tests => 44; >+use Test::MockModule; > use Test::Warn; >+use DBD::Mock; > > BEGIN { > use_ok('C4::Biblio'); > } > >+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; >+ } >+); >+ > my @arr; > my $ret; > >-- >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 13230
:
33446
|
33448
|
33449
|
33450