Lines 36-42
use File::Find;
Link Here
|
36 |
use Test::Warn; |
36 |
use Test::Warn; |
37 |
use File::Temp qw/ tempdir /; |
37 |
use File::Temp qw/ tempdir /; |
38 |
use File::Path; |
38 |
use File::Path; |
39 |
use DBI; |
39 |
|
|
|
40 |
use t::lib::Mocks; |
40 |
|
41 |
|
41 |
our $child; |
42 |
our $child; |
42 |
our $datadir; |
43 |
our $datadir; |
Lines 83-88
sub cleanup {
Link Here
|
83 |
} |
84 |
} |
84 |
} |
85 |
} |
85 |
|
86 |
|
|
|
87 |
BEGIN { |
88 |
t::lib::Mocks::mock_dbh; |
89 |
} |
86 |
# Fall back to make sure that the Zebra process |
90 |
# Fall back to make sure that the Zebra process |
87 |
# and files get cleaned up |
91 |
# and files get cleaned up |
88 |
END { |
92 |
END { |
Lines 97-106
our $QueryRemoveStopwords = 0;
Link Here
|
97 |
our $UseQueryParser = 0; |
101 |
our $UseQueryParser = 0; |
98 |
our $marcflavour = 'MARC21'; |
102 |
our $marcflavour = 'MARC21'; |
99 |
our $contextmodule = new Test::MockModule('C4::Context'); |
103 |
our $contextmodule = new Test::MockModule('C4::Context'); |
100 |
$contextmodule->mock('_new_dbh', sub { |
|
|
101 |
my $dbh = DBI->connect( 'DBI:Mock:', '', '' ) |
102 |
|| die "Cannot create handle: $DBI::errstr\n"; |
103 |
return $dbh }); |
104 |
$contextmodule->mock('preference', sub { |
104 |
$contextmodule->mock('preference', sub { |
105 |
my ($self, $pref) = @_; |
105 |
my ($self, $pref) = @_; |
106 |
if ($pref eq 'marcflavour') { |
106 |
if ($pref eq 'marcflavour') { |
Lines 259-287
sub run_marc21_search_tests {
Link Here
|
259 |
); |
259 |
); |
260 |
return \%hash; |
260 |
return \%hash; |
261 |
}); |
261 |
}); |
262 |
my $dbh = C4::Context->dbh; |
|
|
263 |
$dbh->{mock_add_resultset} = { |
264 |
sql => 'SHOW COLUMNS FROM items', |
265 |
results => [ |
266 |
[ 'rows' ], # seems like $sth->rows is getting called |
267 |
# implicitly, so we need this to make |
268 |
# DBD::Mock return all of the results |
269 |
[ 'itemnumber' ], [ 'biblionumber' ], [ 'biblioitemnumber' ], |
270 |
[ 'barcode' ], [ 'dateaccessioned' ], [ 'booksellerid' ], |
271 |
[ 'homebranch' ], [ 'price' ], [ 'replacementprice' ], |
272 |
[ 'replacementpricedate' ], [ 'datelastborrowed' ], [ 'datelastseen' ], |
273 |
[ 'stack' ], [ 'notforloan' ], [ 'damaged' ], |
274 |
[ 'itemlost' ], [ 'withdrawn' ], [ 'itemcallnumber' ], |
275 |
[ 'issues' ], [ 'renewals' ], [ 'reserves' ], |
276 |
[ 'restricted' ], [ 'itemnotes' ], [ 'nonpublicnote' ], |
277 |
[ 'holdingbranch' ], [ 'paidfor' ], [ 'timestamp' ], |
278 |
[ 'location' ], [ 'permanent_location' ], [ 'onloan' ], |
279 |
[ 'cn_source' ], [ 'cn_sort' ], [ 'ccode' ], |
280 |
[ 'materials' ], [ 'uri' ], [ 'itype' ], |
281 |
[ 'more_subfields_xml' ], [ 'enumchron' ], [ 'copynumber' ], |
282 |
[ 'stocknumber' ], |
283 |
] |
284 |
}; |
285 |
|
262 |
|
286 |
my %branches = ( |
263 |
my %branches = ( |
287 |
'CPL' => { 'branchaddress1' => 'Jefferson Summit', 'branchcode' => 'CPL', 'branchname' => 'Centerville', }, |
264 |
'CPL' => { 'branchaddress1' => 'Jefferson Summit', 'branchcode' => 'CPL', 'branchname' => 'Centerville', }, |
288 |
- |
|
|