Bugzilla – Attachment 103086 Details for
Bug 24807
Add "year" type to improve sorting by publication date
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24807: Update tests
Bug-24807-Update-tests.patch (text/plain), 4.18 KB, created by
David Gustafsson
on 2020-04-16 12:53:13 UTC
(
hide
)
Description:
Bug 24807: Update tests
Filename:
MIME Type:
Creator:
David Gustafsson
Created:
2020-04-16 12:53:13 UTC
Size:
4.18 KB
patch
obsolete
>From a9cbfdd31019f8c361aef622537bd6eefc66fe3f Mon Sep 17 00:00:00 2001 >From: David Gustafsson <glasklas@gmail.com> >Date: Thu, 16 Apr 2020 14:51:13 +0200 >Subject: [PATCH] Bug 24807: Update tests > >--- > t/Koha/SearchEngine/Elasticsearch.t | 39 ++++++++++++++++++++++++----- > 1 file changed, 33 insertions(+), 6 deletions(-) > >diff --git a/t/Koha/SearchEngine/Elasticsearch.t b/t/Koha/SearchEngine/Elasticsearch.t >index 319dce8e15..9d9871a48d 100644 >--- a/t/Koha/SearchEngine/Elasticsearch.t >+++ b/t/Koha/SearchEngine/Elasticsearch.t >@@ -118,7 +118,7 @@ subtest 'get_elasticsearch_mappings() tests' => sub { > > subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' => sub { > >- plan tests => 56; >+ plan tests => 58; > > t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); > t::lib::Mocks::mock_preference('ElasticsearchMARCFormat', 'ISO2709'); >@@ -283,8 +283,18 @@ subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' > sort => 1, > marc_type => 'marc21', > marc_field => '952l', >- }, >- { >+ }, >+ { >+ name => 'copydate', >+ type => 'year', >+ facet => 0, >+ suggestible => 0, >+ searchable => 1, >+ sort => 1, >+ marc_type => 'marc21', >+ marc_field => '260c', >+ }, >+ { > name => 'date-of-publication', > type => 'year', > facet => 0, >@@ -333,6 +343,7 @@ subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' > MARC::Field->new('210', '', '', a => 'Title 1'), > MARC::Field->new('240', '', '4', a => 'The uniform title with nonfiling indicator'), > MARC::Field->new('245', '', '', a => 'Title:', b => 'first record'), >+ MARC::Field->new('260', '', '', a => 'New York :', b => 'Ace ,', c => 'c1962'), > MARC::Field->new('999', '', '', c => '1234567'), > # ' ' for testing trimming of white space in boolean value callback: > MARC::Field->new('952', '', '', 0 => ' ', g => '123.30', o => $callno, l => 3), >@@ -469,10 +480,16 @@ subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' > 'First document uniform_title__sort field should contain the title with the first four initial characters removed' > ); > >- # Tests for 'year' type and 'filter_callbacks' >+ # Tests for 'year' type > is(scalar @{$docs->[0]->{'date-of-publication'}}, 1, 'First document date-of-publication field should contain one value'); > is_deeply($docs->[0]->{'date-of-publication'}, ['1962'], 'First document date-of-publication field should be set correctly'); > >+ is_deeply( >+ $docs->[0]->{'copydate'}, >+ ['1962'], >+ 'First document copydate field should be set correctly' >+ ); >+ > # Second record: > > is(scalar @{$docs->[1]->{author}}, 1, 'Second document author field should contain one value'); >@@ -497,8 +514,17 @@ subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' > 'Second document local_classification__sort field should be set correctly' > ); > >- # Tests for 'year' type and 'filter_callbacks' >- ok(!(defined $docs->[1]->{'date-of-publication'}), "Second document invalid date-of-publication value should have been removed"); >+ # Tests for 'year' type >+ is_deeply( >+ $docs->[1]->{'copydate'}, >+ ['1963','2003'], >+ 'Second document copydate field should be set correctly' >+ ); >+ is_deeply( >+ $docs->[1]->{'date-of-publication'}, >+ ['1900'], >+ 'Second document date-of-publication field should be set correctly' >+ ); > > # Mappings marc_type: > >@@ -633,6 +659,7 @@ subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents_array () t > MARC::Field->new('100', '', '', a => 'Author 2'), > # MARC::Field->new('210', '', '', a => 'Title 2'), > # MARC::Field->new('245', '', '', a => 'Title: second record'), >+ MARC::Field->new('260', '', '', a => 'New York :', b => 'Ace ,', c => '1963-2003'), > MARC::Field->new('999', '', '', c => '1234568'), > MARC::Field->new('952', '', '', 0 => 1, g => 'string where should be numeric'), > ); >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 24807
:
100170
|
100171
|
100176
|
102547
|
102548
|
103084
|
103085
|
103086
|
103087
|
103163
|
103277
|
104525
|
104526
|
104527
|
104528
|
104529
|
104530
|
104531
|
106768
|
108382
|
108383
|
108384
|
108385
|
108386
|
108387
|
108388
|
108389
|
109997
|
109998
|
109999
|
110000
|
110001
|
110002
|
110003
|
110004
|
110355
|
110884