Lines 27-33
use Module::Load::Conditional qw/check_install/;
Link Here
|
27 |
|
27 |
|
28 |
BEGIN { |
28 |
BEGIN { |
29 |
if ( check_install( module => 'Test::DBIx::Class' ) ) { |
29 |
if ( check_install( module => 'Test::DBIx::Class' ) ) { |
30 |
plan tests => 12; |
30 |
plan tests => 13; |
31 |
} else { |
31 |
} else { |
32 |
plan skip_all => "Need Test::DBIx::Class" |
32 |
plan skip_all => "Need Test::DBIx::Class" |
33 |
} |
33 |
} |
Lines 264-269
subtest '_get_match_keys() tests' => sub {
Link Here
|
264 |
|
264 |
|
265 |
}; |
265 |
}; |
266 |
|
266 |
|
|
|
267 |
subtest '_get_match_keys() leader tests' => sub { |
268 |
plan tests => 2; |
269 |
my $record = MARC::Record->new(); |
270 |
my $matchpoint = get_leader_matchpoint({ |
271 |
length => 1, |
272 |
offset => 6, |
273 |
}); |
274 |
|
275 |
my @keys = C4::Matcher::_get_match_keys( $record, $matchpoint ); |
276 |
is( $keys[0], ' ', 'Match key correctly calculated as " " from LDR6 when no leader available'); |
277 |
|
278 |
$record->leader('01344cam a22003014a 4500'); |
279 |
|
280 |
@keys = C4::Matcher::_get_match_keys( $record, $matchpoint ); |
281 |
is( $keys[0], 'a', 'Match key correctly calculated as "a" from LDR6'); |
282 |
}; |
283 |
|
267 |
sub get_title_matchpoint { |
284 |
sub get_title_matchpoint { |
268 |
|
285 |
|
269 |
my $params = shift; |
286 |
my $params = shift; |
Lines 358-360
sub get_isbn_matchpoint {
Link Here
|
358 |
|
375 |
|
359 |
return $matchpoint; |
376 |
return $matchpoint; |
360 |
} |
377 |
} |
361 |
- |
378 |
|
|
|
379 |
sub get_leader_matchpoint { |
380 |
my $params = shift; |
381 |
my $length = $params->{length} // 0; |
382 |
my $norms = $params->{norms} // []; |
383 |
my $offset = $params->{offset} // 0; |
384 |
|
385 |
my $matchpoint = { |
386 |
components => [ |
387 |
{ |
388 |
length => $length, |
389 |
norms => $norms, |
390 |
offset => $offset, |
391 |
tag => 'LDR' |
392 |
}, |
393 |
], |
394 |
}; |
395 |
|
396 |
return $matchpoint; |
397 |
} |