Bugzilla – Attachment 174960 Details for
Bug 33296
Linker should search for authority records with an appropriate 008/14,15,16 value
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33296: Unit tests
Bug-33296-Unit-tests.patch (text/plain), 3.88 KB, created by
Roman Dolny
on 2024-11-23 17:04:05 UTC
(
hide
)
Description:
Bug 33296: Unit tests
Filename:
MIME Type:
Creator:
Roman Dolny
Created:
2024-11-23 17:04:05 UTC
Size:
3.88 KB
patch
obsolete
>From b6d91cd8861f020f37c9d559a5ff3e049f840c0e Mon Sep 17 00:00:00 2001 >From: Janusz Kaczmarek <januszop@gmail.com> >Date: Sat, 23 Nov 2024 15:46:57 +0000 >Subject: [PATCH] Bug 33296: Unit tests > >Unit tests for Bug 33296. > >Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl> >--- > t/db_dependent/Heading.t | 57 ++++++++++++++++++++++++++++++++++++++-- > 1 file changed, 55 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Heading.t b/t/db_dependent/Heading.t >index 80ce96b842..58b80cb826 100755 >--- a/t/db_dependent/Heading.t >+++ b/t/db_dependent/Heading.t >@@ -65,7 +65,7 @@ subtest "UNIMARC tests" => sub { > > subtest "_search tests" => sub { > >- plan tests => 10; >+ plan tests => 14; > > t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); > t::lib::Mocks::mock_preference('SearchEngine', 'Elasticsearch'); >@@ -80,7 +80,8 @@ subtest "_search tests" => sub { > return ($search_query, 1 ); > }); > >- t::lib::Mocks::mock_preference('LinkerConsiderThesaurus', '0'); >+ t::lib::Mocks::mock_preference( 'LinkerConsiderThesaurus', '0' ); >+ t::lib::Mocks::mock_preference( 'ConsiderHeadingUse', '0' ); > > my $field = MARC::Field->new( '650', ' ', '0', a => 'Uncles', x => 'Fiction' ); > my $heading = C4::Heading->new_from_field($field); >@@ -194,4 +195,56 @@ subtest "_search tests" => sub { > ]; > is_deeply( $terms, $expected_terms, "When thesaurus in subfield 2, and nothing is found, we don't search again if LinkerConsiderThesaurusDisabled"); > >+ t::lib::Mocks::mock_preference( 'ConsiderHeadingUse', '1' ); >+ >+ ($search_query) = $heading->_search('match-heading'); >+ $terms = $search_query->{query}->{bool}->{must}; >+ $expected_terms = [ >+ { term => { 'match-heading.ci_raw' => 'Uncles generalsubdiv Fiction' } }, >+ { term => { 'heading-use-subject-added-entry.ci_raw' => 'a' } }, >+ ]; >+ is_deeply( >+ $terms, $expected_terms, >+ "With ConsiderHeadingUse on and 650 tag Heading-use-subject-added-entry = 'a' is required in search query" >+ ); >+ use Data::Dumper; >+ >+ my $field_700 = MARC::Field->new( '700', '1', '2', a => 'Shakespeare William', t => 'Othello' ); >+ my $heading_700 = C4::Heading->new_from_field($field_700); >+ ($search_query) = $heading_700->_search('match-heading'); >+ $terms = $search_query->{query}->{bool}->{must}; >+ $expected_terms = [ >+ { term => { 'match-heading.ci_raw' => 'Shakespeare William Othello' } }, >+ { term => { 'heading-use-main-or-added-entry.ci_raw' => 'a' } }, >+ ]; >+ is_deeply( >+ $terms, $expected_terms, >+ "With ConsiderHeadingUse on and 700 tag Heading-use-main-or-added-entry = 'a' is required in search query" >+ ); >+ >+ my $field_800 = MARC::Field->new( '800', '1', ' ', a => 'Shakespeare William', t => 'Collected works' ); >+ my $heading_800 = C4::Heading->new_from_field($field_800); >+ ($search_query) = $heading_800->_search('match-heading'); >+ $terms = $search_query->{query}->{bool}->{must}; >+ $expected_terms = [ >+ { term => { 'match-heading.ci_raw' => 'Shakespeare William Collected works' } }, >+ { term => { 'heading-use-series-added-entry.ci_raw' => 'a' } }, >+ ]; >+ is_deeply( >+ $terms, $expected_terms, >+ "With ConsiderHeadingUse on and 800 tag Heading-use-series-added-entry = 'a' is required in search query" >+ ); >+ >+ t::lib::Mocks::mock_preference( 'ConsiderHeadingUse', '0' ); >+ >+ ($search_query) = $heading_800->_search('match-heading'); >+ $terms = $search_query->{query}->{bool}->{must}; >+ $expected_terms = [ >+ { term => { 'match-heading.ci_raw' => 'Shakespeare William Collected works' } }, >+ ]; >+ is_deeply( >+ $terms, $expected_terms, >+ "With ConsiderHeadingUse off and 800 tag there is no Heading-use-series-added-entry condition in search query" >+ ); >+ > }; >-- >2.39.5
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 33296
:
174957
|
174958
|
174959
|
174960
|
177746
|
177747