|
Lines 29-37
require C4::Context;
Link Here
|
| 29 |
# work around spurious wide character warnings |
29 |
# work around spurious wide character warnings |
| 30 |
use open ':std', ':encoding(utf8)'; |
30 |
use open ':std', ':encoding(utf8)'; |
| 31 |
|
31 |
|
| 32 |
use Test::More tests => 2; |
32 |
use Test::More tests => 3; |
| 33 |
use Test::MockModule; |
33 |
use Test::MockModule; |
| 34 |
use Test::Warn; |
34 |
use Test::Warn; |
|
|
35 |
use t::lib::Mocks; |
| 35 |
|
36 |
|
| 36 |
use Koha::Caches; |
37 |
use Koha::Caches; |
| 37 |
|
38 |
|
|
Lines 211-216
sub mock_GetMarcSubfieldStructure {
Link Here
|
| 211 |
'biblio.biblionumber' => [{ tagfield => '999', tagsubfield => 'c' }], |
212 |
'biblio.biblionumber' => [{ tagfield => '999', tagsubfield => 'c' }], |
| 212 |
'biblio.isbn' => [{ tagfield => '020', tagsubfield => 'a' }], |
213 |
'biblio.isbn' => [{ tagfield => '020', tagsubfield => 'a' }], |
| 213 |
'biblio.title' => [{ tagfield => '245', tagsubfield => 'a' }], |
214 |
'biblio.title' => [{ tagfield => '245', tagsubfield => 'a' }], |
|
|
215 |
'biblio.author' => [{ tagfield => '100', tagsubfield => 'a' }], |
| 214 |
'biblio.notes' => [{ tagfield => '500', tagsubfield => 'a' }], |
216 |
'biblio.notes' => [{ tagfield => '500', tagsubfield => 'a' }], |
| 215 |
'items.barcode' => [{ tagfield => '952', tagsubfield => 'p' }], |
217 |
'items.barcode' => [{ tagfield => '952', tagsubfield => 'p' }], |
| 216 |
'items.booksellerid' => [{ tagfield => '952', tagsubfield => 'e' }], |
218 |
'items.booksellerid' => [{ tagfield => '952', tagsubfield => 'e' }], |
|
Lines 921-926
subtest 'UNIMARC + DOM' => sub {
Link Here
|
| 921 |
run_unimarc_search_tests(); |
923 |
run_unimarc_search_tests(); |
| 922 |
}; |
924 |
}; |
| 923 |
|
925 |
|
|
|
926 |
|
| 927 |
subtest 'FindDuplicate' => sub { |
| 928 |
plan tests => 3; |
| 929 |
Koha::Caches->get_instance('config')->flush_all; |
| 930 |
t::lib::Mocks::mock_preference('marcflavour', 'marc21' ); |
| 931 |
mock_GetMarcSubfieldStructure('marc21'); |
| 932 |
my $searcher = Test::MockModule->new('C4::Search'); |
| 933 |
$searcher->mock('SimpleSearch', sub { |
| 934 |
warn shift @_; |
| 935 |
return 1; |
| 936 |
}); |
| 937 |
|
| 938 |
my $record = MARC::Record->new; |
| 939 |
$record->add_fields( |
| 940 |
[ '100', '0', '0', a => 'Morgenstern, Erin' ], |
| 941 |
[ '245', '0', '0', a => 'The night circus /' ] |
| 942 |
); |
| 943 |
warning_is { C4::Search::FindDuplicate($record);} |
| 944 |
q/ti,ext:"The night circus \/" and au,ext:"Morgenstern, Erin"/,"Term correctly formed"; |
| 945 |
|
| 946 |
$record = MARC::Record->new; |
| 947 |
$record->add_fields( |
| 948 |
[ '245', '0', '0', a => 'The book of nothing /' ] |
| 949 |
); |
| 950 |
warning_is { C4::Search::FindDuplicate($record);} |
| 951 |
q/ti,ext:"The book of nothing \/"/,"Term correctly formed"; |
| 952 |
|
| 953 |
$record = MARC::Record->new; |
| 954 |
$record->add_fields( |
| 955 |
[ '245', '0', '0', a => 'Frog and toad all year /' ] |
| 956 |
); |
| 957 |
warning_is { C4::Search::FindDuplicate($record);} |
| 958 |
q/ti,ext:"Frog and toad all year \/"/,"Term correctly formed"; |
| 959 |
|
| 960 |
}; |
| 961 |
|
| 924 |
# Make sure that following tests are not using our config settings |
962 |
# Make sure that following tests are not using our config settings |
| 925 |
Koha::Caches->get_instance('config')->flush_all; |
963 |
Koha::Caches->get_instance('config')->flush_all; |
| 926 |
|
964 |
|
| 927 |
- |
|
|