Lines 181-189
subtest "searchResults PassItemMarcToXSLT test" => sub {
Link Here
|
181 |
t::lib::Mocks::mock_preference('marcflavour','MARC21'); |
181 |
t::lib::Mocks::mock_preference('marcflavour','MARC21'); |
182 |
my $mock_xslt = Test::MockModule->new("C4::Search"); |
182 |
my $mock_xslt = Test::MockModule->new("C4::Search"); |
183 |
$mock_xslt->mock( XSLTParse4Display => sub { |
183 |
$mock_xslt->mock( XSLTParse4Display => sub { |
184 |
my (undef, $record) = @_; |
184 |
my $params = shift; |
|
|
185 |
my $record = $params->{record}; |
185 |
warn $record->field('952') ? "Item here" : "No item"; |
186 |
warn $record->field('952') ? "Item here" : "No item"; |
186 |
return undef; |
187 |
return; |
187 |
}); |
188 |
}); |
188 |
|
189 |
|
189 |
my $builder = t::lib::TestBuilder->new; |
190 |
my $builder = t::lib::TestBuilder->new; |
Lines 194-206
subtest "searchResults PassItemMarcToXSLT test" => sub {
Link Here
|
194 |
|
195 |
|
195 |
t::lib::Mocks::mock_preference('PassItemMarcToXSLT','1'); |
196 |
t::lib::Mocks::mock_preference('PassItemMarcToXSLT','1'); |
196 |
|
197 |
|
197 |
warnings_like { searchResults({ interface => "opac" },"test",1,1,0,0,[ $record->as_xml_record ] ,undef) } |
198 |
warnings_like { C4::Search::searchResults({ interface => "opac" },"test",1,1,0,0,[ $record->as_xml_record ] ,undef) } |
198 |
[qr/Item here/], |
199 |
[qr/Item here/], |
199 |
"Item field returned from default XSLT if pref set"; |
200 |
"Item field returned from default XSLT if pref set"; |
200 |
|
201 |
|
201 |
t::lib::Mocks::mock_preference('PassItemMarcToXSLT','0'); |
202 |
t::lib::Mocks::mock_preference('PassItemMarcToXSLT','0'); |
202 |
|
203 |
|
203 |
warnings_like { searchResults({ interface => "opac" },"test",1,1,0,0,[ $record->as_xml_record ] ,undef) } |
204 |
warnings_like { C4::Search::searchResults({ interface => "opac" },"test",1,1,0,0,[ $record->as_xml_record ] ,undef) } |
204 |
[qr/No item/], |
205 |
[qr/No item/], |
205 |
"Item field returned from default XSLT if pref set"; |
206 |
"Item field returned from default XSLT if pref set"; |
206 |
|
207 |
|
207 |
- |
|
|