Lines 17-30
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
|
|
20 |
use C4::Biblio; |
20 |
use Test::More; |
21 |
use Test::More; |
|
|
22 |
use Test::MockModule; |
23 |
use Test::Warn; |
21 |
use t::lib::Mocks; |
24 |
use t::lib::Mocks; |
|
|
25 |
use t::lib::TestBuilder; |
22 |
|
26 |
|
23 |
use Module::Load::Conditional qw/check_install/; |
27 |
use Module::Load::Conditional qw/check_install/; |
24 |
|
28 |
|
25 |
BEGIN { |
29 |
BEGIN { |
26 |
if ( check_install( module => 'Test::DBIx::Class' ) ) { |
30 |
if ( check_install( module => 'Test::DBIx::Class' ) ) { |
27 |
plan tests => 3; |
31 |
plan tests => 4; |
28 |
} else { |
32 |
} else { |
29 |
plan skip_all => "Need Test::DBIx::Class" |
33 |
plan skip_all => "Need Test::DBIx::Class" |
30 |
} |
34 |
} |
Lines 169-172
subtest "_build_initial_query tests" => sub {
Link Here
|
169 |
|
173 |
|
170 |
}; |
174 |
}; |
171 |
|
175 |
|
|
|
176 |
subtest "searchResults PassItemMarcToXSLT test" => sub { |
172 |
|
177 |
|
173 |
- |
178 |
plan tests => 2; |
|
|
179 |
|
180 |
t::lib::Mocks::mock_preference('OPACXSLTResultsDisplay','default'); |
181 |
t::lib::Mocks::mock_preference('marcflavour','MARC21'); |
182 |
my $mock_xslt = Test::MockModule->new("C4::Search"); |
183 |
$mock_xslt->mock( XSLTParse4Display => sub { |
184 |
my (undef, $record) = @_; |
185 |
warn $record->field('952') ? "Item here" : "No item"; |
186 |
return undef; |
187 |
}); |
188 |
|
189 |
my $builder = t::lib::TestBuilder->new; |
190 |
|
191 |
my $item = $builder->build_sample_item(); |
192 |
my $record = $item->biblio->metadata->record; |
193 |
C4::Biblio::EmbedItemsInMarcBiblio({ marc_record => $record, biblionumber => $item->biblionumber }); |
194 |
|
195 |
t::lib::Mocks::mock_preference('PassItemMarcToXSLT','1'); |
196 |
|
197 |
warnings_like { searchResults({ interface => "opac" },"test",1,1,0,0,[ $record->as_xml_record ] ,undef) } |
198 |
[qr/Item here/], |
199 |
"Item field returned from default XSLT if pref set"; |
200 |
|
201 |
t::lib::Mocks::mock_preference('PassItemMarcToXSLT','0'); |
202 |
|
203 |
warnings_like { searchResults({ interface => "opac" },"test",1,1,0,0,[ $record->as_xml_record ] ,undef) } |
204 |
[qr/No item/], |
205 |
"Item field returned from default XSLT if pref set"; |
206 |
|
207 |
} |