Lines 56-65
subtest '_do_xslt_proc' => sub {
Link Here
|
56 |
plan tests => 6; |
56 |
plan tests => 6; |
57 |
test_do_xslt(); |
57 |
test_do_xslt(); |
58 |
}; |
58 |
}; |
59 |
#Group 4: testing _add_rowdata (part of Z3950Search) |
59 |
#Group 4: testing _add_custom_field_rowdata (part of Z3950Search) |
60 |
subtest '_add_rowdata' => sub { |
60 |
subtest '_add_custom_field_rowdata' => sub { |
61 |
plan tests => 5; |
61 |
plan tests => 3; |
62 |
test_add_rowdata(); |
62 |
test_add_custom_field_rowdata(); |
63 |
}; |
63 |
}; |
64 |
|
64 |
|
65 |
subtest ImportBreedingAuth => sub { |
65 |
subtest ImportBreedingAuth => sub { |
Lines 261-304
sub test_do_xslt {
Link Here
|
261 |
'At least the title is the same :)' ); |
261 |
'At least the title is the same :)' ); |
262 |
} |
262 |
} |
263 |
|
263 |
|
264 |
sub test_add_rowdata { |
264 |
sub test_add_custom_field_rowdata { |
265 |
t::lib::Mocks::mock_preference('AdditionalFieldsInZ3950ResultSearch',''); |
|
|
266 |
|
267 |
my $row = { |
265 |
my $row = { |
268 |
biblionumber => 0, |
266 |
biblionumber => 0, |
269 |
server => "testServer", |
267 |
server => "testServer", |
270 |
breedingid => 0 |
268 |
breedingid => 0, |
|
|
269 |
title => "Just a title" |
271 |
}; |
270 |
}; |
272 |
|
271 |
|
273 |
my $biblio = MARC::Record->new(); |
272 |
my $biblio = MARC::Record->new(); |
274 |
$biblio->append_fields( |
273 |
$biblio->append_fields( |
275 |
MARC::Field->new('245', ' ', ' ', a => 'Just a title'), #title |
274 |
MARC::Field->new('245', ' ', ' ', a => 'Just a title'), |
|
|
275 |
MARC::Field->new('035', ' ', ' ', a => 'First 035'), |
276 |
MARC::Field->new('035', ' ', ' ', a => 'Second 035') |
276 |
); |
277 |
); |
277 |
|
278 |
|
278 |
my $returned_row = C4::Breeding::_add_rowdata($row, $biblio); |
279 |
t::lib::Mocks::mock_preference('AdditionalFieldsInZ3950ResultSearch',"245\$a, 035\$a"); |
279 |
|
|
|
280 |
is($returned_row->{title}, "Just a title", "_add_rowdata returns the title of a biblio"); |
281 |
is($returned_row->{addnumberfields}[0], undef, "_add_rowdata returns undef if it has no additionnal field"); |
282 |
|
280 |
|
283 |
t::lib::Mocks::mock_preference('AdditionalFieldsInZ3950ResultSearch',"245\$a, 035\$a"); |
281 |
my $returned_row = C4::Breeding::_add_custom_field_rowdata($row, $biblio); |
284 |
|
|
|
285 |
$row = { |
286 |
biblionumber => 0, |
287 |
server => "testServer", |
288 |
breedingid => 0 |
289 |
}; |
290 |
$biblio = MARC::Record->new(); |
291 |
$biblio->append_fields( |
292 |
MARC::Field->new('245', ' ', ' ', a => 'Just a title'), #title |
293 |
MARC::Field->new('035', ' ', ' ', a => 'First 035'), |
294 |
MARC::Field->new('035', ' ', ' ', a => 'Second 035') |
295 |
); |
296 |
$returned_row = C4::Breeding::_add_rowdata($row, $biblio); |
297 |
|
282 |
|
298 |
is($returned_row->{title}, "Just a title", "_add_rowdata returns the title of a biblio"); |
283 |
is($returned_row->{title}, "Just a title", "_add_rowdata returns the title of a biblio"); |
299 |
is($returned_row->{addnumberfields}[0], "245\$a", "_add_rowdata returns the field number chosen in the AdditionalFieldsInZ3950ResultSearch preference"); |
284 |
is($returned_row->{addnumberfields}[0], "245\$a", "_add_rowdata returns the field number chosen in the AdditionalFieldsInZ3950ResultSearch preference"); |
300 |
|
285 |
|
301 |
# Test repeatble tags,the trailing whitespace is a normal side-effect of _add_custom_row_data |
286 |
# Test repeatble tags,the trailing whitespace is a normal side-effect of _add_custom_field_row_data |
302 |
is_deeply(\$returned_row->{"035\$a"}, \["First 035 ", "Second 035 "],"_add_rowdata supports repeatable tags"); |
287 |
is_deeply(\$returned_row->{"035\$a"}, \["First 035 ", "Second 035 "],"_add_rowdata supports repeatable tags"); |
303 |
} |
288 |
} |
304 |
|
289 |
|
305 |
- |
|
|