Lines 186-192
subtest 'get_elasticsearch_mappings() tests' => sub {
Link Here
|
186 |
|
186 |
|
187 |
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' => sub { |
187 |
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' => sub { |
188 |
|
188 |
|
189 |
plan tests => 66; |
189 |
plan tests => 72; |
190 |
|
190 |
|
191 |
t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); |
191 |
t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); |
192 |
t::lib::Mocks::mock_preference('ElasticsearchMARCFormat', 'ISO2709'); |
192 |
t::lib::Mocks::mock_preference('ElasticsearchMARCFormat', 'ISO2709'); |
Lines 752-757
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
752 |
is_deeply( $docs->[0]->{author},[],'No value placed into field if mapped marc field is blank'); |
752 |
is_deeply( $docs->[0]->{author},[],'No value placed into field if mapped marc field is blank'); |
753 |
is_deeply( $docs->[0]->{author__suggestion},[],'No value placed into suggestion if mapped marc field is blank'); |
753 |
is_deeply( $docs->[0]->{author__suggestion},[],'No value placed into suggestion if mapped marc field is blank'); |
754 |
|
754 |
|
|
|
755 |
foreach my $syspref_val ( 'MARCXML', 'MARCXML_COMPRESSED' ) { |
756 |
t::lib::Mocks::mock_preference( 'ElasticsearchMARCFormat', $syspref_val ); |
757 |
my $test_record = MARC::Record->new(); |
758 |
$test_record->leader(' cam 22 a 4500'); |
759 |
|
760 |
$test_record->append_fields( |
761 |
MARC::Field->new( '100', '', '', a => 'Author 1' ), |
762 |
MARC::Field->new( '110', '', '', a => 'Corp Author' ), |
763 |
MARC::Field->new( '245', '', '', a => 'Title:', b => 'test record' ), |
764 |
MARC::Field->new( '999', '', '', c => '1234567' ), |
765 |
); |
766 |
|
767 |
$docs = $see->marc_records_to_documents( [$test_record] ); |
768 |
|
769 |
is( $docs->[0]->{marc_format}, $syspref_val, 'marc_format matches system preference value' ); |
770 |
|
771 |
$decoded_marc_record = $see->decode_record_from_result( $docs->[0] ); |
772 |
|
773 |
ok( $decoded_marc_record->isa('MARC::Record'), "MARCXML record successfully decoded from result" ); |
774 |
is( |
775 |
$decoded_marc_record->as_xml_record(), $test_record->as_xml_record(), |
776 |
"Decoded MARCXML record has same data as original record" |
777 |
); |
778 |
} |
755 |
}; |
779 |
}; |
756 |
|
780 |
|
757 |
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents_array () tests' => sub { |
781 |
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents_array () tests' => sub { |
758 |
- |
|
|