Lines 56-62
subtest '_do_xslt_proc' => sub {
Link Here
|
56 |
}; |
56 |
}; |
57 |
#Group 4: testing _add_custom_field_rowdata (part of Z3950Search) |
57 |
#Group 4: testing _add_custom_field_rowdata (part of Z3950Search) |
58 |
subtest '_add_custom_field_rowdata' => sub { |
58 |
subtest '_add_custom_field_rowdata' => sub { |
59 |
plan tests => 3; |
59 |
plan tests => 5; |
60 |
test_add_custom_field_rowdata(); |
60 |
test_add_custom_field_rowdata(); |
61 |
}; |
61 |
}; |
62 |
|
62 |
|
Lines 237-264
sub test_do_xslt {
Link Here
|
237 |
|
237 |
|
238 |
sub test_add_custom_field_rowdata { |
238 |
sub test_add_custom_field_rowdata { |
239 |
my $row = { |
239 |
my $row = { |
240 |
biblionumber => 0, |
240 |
biblionumber => 0, |
241 |
server => "testServer", |
241 |
server => "testServer", |
242 |
breedingid => 0, |
242 |
breedingid => 0, |
243 |
title => "Just a title" |
243 |
title => "Just a title" |
244 |
}; |
244 |
}; |
245 |
|
245 |
|
246 |
my $biblio = MARC::Record->new(); |
246 |
my $biblio = MARC::Record->new(); |
247 |
$biblio->append_fields( |
247 |
$biblio->append_fields( |
248 |
MARC::Field->new('245', ' ', ' ', a => 'Just a title'), |
248 |
MARC::Field->new( '245', ' ', ' ', a => 'Just a title' ), |
249 |
MARC::Field->new('035', ' ', ' ', a => 'First 035'), |
249 |
MARC::Field->new( '035', ' ', ' ', a => 'First 035' ), |
250 |
MARC::Field->new('035', ' ', ' ', a => 'Second 035') |
250 |
MARC::Field->new( '035', ' ', ' ', a => 'Second 035' ) |
251 |
); |
251 |
); |
252 |
|
252 |
|
253 |
t::lib::Mocks::mock_preference('AdditionalFieldsInZ3950ResultSearch',"245\$a, 035\$a"); |
253 |
my $pref_newtags = "245\$a, 035\$a"; |
254 |
|
254 |
|
255 |
my $returned_row = C4::Breeding::_add_custom_field_rowdata($row, $biblio); |
255 |
my $returned_row = C4::Breeding::_add_custom_field_rowdata( $row, $biblio, $pref_newtags ); |
|
|
256 |
|
257 |
is( $returned_row->{title}, "Just a title", "_add_rowdata returns the title of a biblio" ); |
258 |
is( |
259 |
$returned_row->{addnumberfields}[0], "245\$a", |
260 |
"_add_rowdata returns the field number chosen in the AdditionalFieldsInZ3950ResultSearch preference" |
261 |
); |
256 |
|
262 |
|
257 |
is($returned_row->{title}, "Just a title", "_add_rowdata returns the title of a biblio"); |
263 |
# Test repeatble tags,the trailing whitespace is a normal side-effect of _add_custom_field_row_data |
258 |
is($returned_row->{addnumberfields}[0], "245\$a", "_add_rowdata returns the field number chosen in the AdditionalFieldsInZ3950ResultSearch preference"); |
264 |
is_deeply( \$returned_row->{"035\$a"}, \[ "First 035 ", "Second 035 " ], "_add_rowdata supports repeatable tags" ); |
259 |
|
265 |
|
260 |
# Test repeatble tags,the trailing whitespace is a normal side-effect of _add_custom_field_row_data |
266 |
warning_is { C4::Breeding::_add_custom_field_rowdata( $row, $biblio, undef ) } undef, |
261 |
is_deeply(\$returned_row->{"035\$a"}, \["First 035 ", "Second 035 "],"_add_rowdata supports repeatable tags"); |
267 |
'no warn from add_custom_field_rowdata when pref_newtags undef'; |
|
|
268 |
warning_is { C4::Breeding::_add_custom_field_rowdata( $row, $biblio, "" ) } undef, |
269 |
'no warn from add_custom_field_rowdata when pref_newtags blank'; |
262 |
} |
270 |
} |
263 |
|
271 |
|
264 |
sub xsl_file { |
272 |
sub xsl_file { |
265 |
- |
|
|