|
Lines 41-81
subtest 'GetMatcherList' => sub {
Link Here
|
| 41 |
value => { code => 'ISSN', description => 'ISSN', record_type => 'blue', threshold => 0 }, |
41 |
value => { code => 'ISSN', description => 'ISSN', record_type => 'blue', threshold => 0 }, |
| 42 |
}); |
42 |
}); |
| 43 |
|
43 |
|
| 44 |
my @matchers = C4::Matcher::GetMatcherList(); |
44 |
my @matchers = C4::Matcher::GetMatcherList(); |
|
|
45 |
is( $matchers[0]->{'matcher_id'}, $matcher1->{matcher_id}, 'First matcher_id value' ); |
| 46 |
is( $matchers[1]->{'matcher_id'}, $matcher2->{matcher_id}, 'Second matcher_id value' ); |
| 45 |
|
47 |
|
| 46 |
is( $matchers[0]->{'matcher_id'}, $matcher1->{matcher_id}, 'First matcher_id value' ); |
48 |
my $matcher_id = C4::Matcher::GetMatcherId('ISBN'); |
|
|
49 |
is( $matcher_id, $matcher1->{matcher_id}, 'testing getmatcherid' ); |
| 47 |
|
50 |
|
| 48 |
is( $matchers[1]->{'matcher_id'}, $matcher2->{matcher_id}, 'Second matcher_id value' ); |
51 |
my $testmatcher; |
|
|
52 |
ok( $testmatcher = C4::Matcher->new( 'red', 1 ), 'testing matcher new' ); |
| 53 |
ok( $testmatcher = C4::Matcher->new( 'blue', 0 ), 'testing matcher new' ); |
| 49 |
|
54 |
|
| 50 |
my $matcher_id = C4::Matcher::GetMatcherId('ISBN'); |
55 |
$testmatcher->threshold(1000); |
|
|
56 |
is( $testmatcher->threshold(), 1000, 'testing threshhold accessor method' ); |
| 51 |
|
57 |
|
| 52 |
is( $matcher_id, $matcher1->{matcher_id}, 'testing getmatcherid' ); |
58 |
$testmatcher->_id(53); |
|
|
59 |
is( $testmatcher->_id(), 53, 'testing _id accessor' ); |
| 53 |
|
60 |
|
| 54 |
my $testmatcher; |
61 |
$testmatcher->code('match on ISBN'); |
|
|
62 |
is( $testmatcher->code(), 'match on ISBN', 'testing code accessor' ); |
| 55 |
|
63 |
|
| 56 |
ok( $testmatcher = C4::Matcher->new( 'red', 1 ), 'testing matcher new' ); |
64 |
$testmatcher->description('match on ISSN'); |
| 57 |
|
65 |
is( $testmatcher->description(), 'match on ISSN', 'testing code accessor' ); |
| 58 |
ok( $testmatcher = C4::Matcher->new( 'blue', 0 ), 'testing matcher new' ); |
|
|
| 59 |
|
| 60 |
$testmatcher->threshold(1000); |
| 61 |
|
| 62 |
is( $testmatcher->threshold(), 1000, 'testing threshhold accessor method' ); |
| 63 |
|
| 64 |
$testmatcher->_id(53); |
| 65 |
|
| 66 |
is( $testmatcher->_id(), 53, 'testing _id accessor' ); |
| 67 |
|
| 68 |
$testmatcher->code('match on ISBN'); |
| 69 |
|
| 70 |
is( $testmatcher->code(), 'match on ISBN', 'testing code accessor' ); |
| 71 |
|
| 72 |
$testmatcher->description('match on ISSN'); |
| 73 |
|
| 74 |
is( $testmatcher->description(), 'match on ISSN', 'testing code accessor' ); |
| 75 |
}; |
66 |
}; |
| 76 |
|
67 |
|
| 77 |
subtest '_get_match_keys() tests' => sub { |
68 |
subtest '_get_match_keys() tests' => sub { |
| 78 |
|
|
|
| 79 |
plan tests => 21; |
69 |
plan tests => 21; |
| 80 |
|
70 |
|
| 81 |
my $matchpoint = get_title_matchpoint({ |
71 |
my $matchpoint = get_title_matchpoint({ |
|
Lines 283-289
subtest '_get_match_keys() leader tests' => sub {
Link Here
|
| 283 |
}; |
273 |
}; |
| 284 |
|
274 |
|
| 285 |
sub get_title_matchpoint { |
275 |
sub get_title_matchpoint { |
| 286 |
|
|
|
| 287 |
my $params = shift; |
276 |
my $params = shift; |
| 288 |
|
277 |
|
| 289 |
my $length = $params->{length} // 0; |
278 |
my $length = $params->{length} // 0; |
|
Lines 312-318
sub get_title_matchpoint {
Link Here
|
| 312 |
} |
301 |
} |
| 313 |
|
302 |
|
| 314 |
sub get_authors_matchpoint { |
303 |
sub get_authors_matchpoint { |
| 315 |
|
|
|
| 316 |
my $params = shift; |
304 |
my $params = shift; |
| 317 |
|
305 |
|
| 318 |
my $length = $params->{length} // 0; |
306 |
my $length = $params->{length} // 0; |
|
Lines 350-356
sub get_authors_matchpoint {
Link Here
|
| 350 |
} |
338 |
} |
| 351 |
|
339 |
|
| 352 |
sub get_isbn_matchpoint { |
340 |
sub get_isbn_matchpoint { |
| 353 |
|
|
|
| 354 |
my $params = shift; |
341 |
my $params = shift; |
| 355 |
|
342 |
|
| 356 |
my $length = $params->{length} // 0; |
343 |
my $length = $params->{length} // 0; |
| 357 |
- |
|
|