Bugzilla – Attachment 43875 Details for
Bug 14778
DBIC should create/own the DB handler
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 14778: Mock the dbh for t/db_dependent/Search.t
PASSED-QA-Bug-14778-Mock-the-dbh-for-tdbdependentS.patch (text/plain), 2.89 KB, created by
Kyle M Hall (khall)
on 2015-10-23 14:57:17 UTC
(
hide
)
Description:
[PASSED QA] Bug 14778: Mock the dbh for t/db_dependent/Search.t
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2015-10-23 14:57:17 UTC
Size:
2.89 KB
patch
obsolete
>From 4257c3fc72909c84103b8c5114f17cf8d786f7f0 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 20 Oct 2015 15:37:40 +0100 >Subject: [PATCH] [PASSED QA] Bug 14778: Mock the dbh for t/db_dependent/Search.t > >No need to mock the items' columns (?) > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > t/db_dependent/Search.t | 33 +++++---------------------------- > 1 files changed, 5 insertions(+), 28 deletions(-) > >diff --git a/t/db_dependent/Search.t b/t/db_dependent/Search.t >index b96cc19..9baef00 100644 >--- a/t/db_dependent/Search.t >+++ b/t/db_dependent/Search.t >@@ -36,7 +36,8 @@ use File::Find; > use Test::Warn; > use File::Temp qw/ tempdir /; > use File::Path; >-use DBI; >+ >+use t::lib::Mocks; > > our $child; > our $datadir; >@@ -83,6 +84,9 @@ sub cleanup { > } > } > >+BEGIN { >+ t::lib::Mocks::mock_dbh; >+} > # Fall back to make sure that the Zebra process > # and files get cleaned up > END { >@@ -97,10 +101,6 @@ our $QueryRemoveStopwords = 0; > our $UseQueryParser = 0; > our $marcflavour = 'MARC21'; > our $contextmodule = new Test::MockModule('C4::Context'); >-$contextmodule->mock('_new_dbh', sub { >- my $dbh = DBI->connect( 'DBI:Mock:', '', '' ) >- || die "Cannot create handle: $DBI::errstr\n"; >- return $dbh }); > $contextmodule->mock('preference', sub { > my ($self, $pref) = @_; > if ($pref eq 'marcflavour') { >@@ -259,29 +259,6 @@ sub run_marc21_search_tests { > ); > return \%hash; > }); >- my $dbh = C4::Context->dbh; >- $dbh->{mock_add_resultset} = { >- sql => 'SHOW COLUMNS FROM items', >- results => [ >- [ 'rows' ], # seems like $sth->rows is getting called >- # implicitly, so we need this to make >- # DBD::Mock return all of the results >- [ 'itemnumber' ], [ 'biblionumber' ], [ 'biblioitemnumber' ], >- [ 'barcode' ], [ 'dateaccessioned' ], [ 'booksellerid' ], >- [ 'homebranch' ], [ 'price' ], [ 'replacementprice' ], >- [ 'replacementpricedate' ], [ 'datelastborrowed' ], [ 'datelastseen' ], >- [ 'stack' ], [ 'notforloan' ], [ 'damaged' ], >- [ 'itemlost' ], [ 'withdrawn' ], [ 'itemcallnumber' ], >- [ 'issues' ], [ 'renewals' ], [ 'reserves' ], >- [ 'restricted' ], [ 'itemnotes' ], [ 'nonpublicnote' ], >- [ 'holdingbranch' ], [ 'paidfor' ], [ 'timestamp' ], >- [ 'location' ], [ 'permanent_location' ], [ 'onloan' ], >- [ 'cn_source' ], [ 'cn_sort' ], [ 'ccode' ], >- [ 'materials' ], [ 'uri' ], [ 'itype' ], >- [ 'more_subfields_xml' ], [ 'enumchron' ], [ 'copynumber' ], >- [ 'stocknumber' ], >- ] >- }; > > my %branches = ( > 'CPL' => { 'branchaddress1' => 'Jefferson Summit', 'branchcode' => 'CPL', 'branchname' => 'Centerville', }, >-- >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 14778
:
42326
|
42388
|
43247
|
43248
|
43249
|
43250
|
43440
|
43631
|
43632
|
43633
|
43634
|
43635
|
43636
|
43637
|
43638
|
43639
|
43640
|
43641
|
43642
|
43643
|
43644
|
43645
|
43834
|
43835
|
43836
|
43837
|
43838
|
43839
|
43840
|
43841
|
43842
|
43843
|
43844
|
43845
|
43846
|
43847
|
43848
|
43849
|
43850
|
43851
|
43852
|
43853
|
43857
|
43858
|
43859
|
43860
|
43861
|
43862
|
43863
|
43864
|
43865
|
43866
|
43867
|
43868
|
43869
|
43870
|
43871
|
43872
|
43873
|
43874
| 43875 |
43876
|
44003