Bugzilla – Attachment 134442 Details for
Bug 23919
Make ISSN searchable with and without hyphen
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23919: Add tests for biblioItems search by ISBN and ISSN with
Bug-23919-Add-tests-for-biblioItems-search-by-ISBN.patch (text/plain), 4.26 KB, created by
Slava Shishkin
on 2022-05-01 15:08:49 UTC
(
hide
)
Description:
Bug 23919: Add tests for biblioItems search by ISBN and ISSN with
Filename:
MIME Type:
Creator:
Slava Shishkin
Created:
2022-05-01 15:08:49 UTC
Size:
4.26 KB
patch
obsolete
>From 5d92017652af5f806255a967db91d7c90d8deb81 Mon Sep 17 00:00:00 2001 >From: Slava Shishkin <slavashishkin@gmail.com> >Date: Thu, 28 Apr 2022 22:38:23 +0300 >Subject: [PATCH] Bug 23919: Add tests for biblioItems search by ISBN and ISSN > with > >variations (sysprefs SearchWithISBNVariations/SearchWithISSNVariations) >--- > t/Search/buildQuery.t | 77 ++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 76 insertions(+), 1 deletion(-) > >diff --git a/t/Search/buildQuery.t b/t/Search/buildQuery.t >index f0163acb8e..58d8158f96 100755 >--- a/t/Search/buildQuery.t >+++ b/t/Search/buildQuery.t >@@ -24,7 +24,7 @@ use Module::Load::Conditional qw/check_install/; > > BEGIN { > if ( check_install( module => 'Test::DBIx::Class' ) ) { >- plan tests => 10; >+ plan tests => 12; > } else { > plan skip_all => "Need Test::DBIx::Class" > } >@@ -62,6 +62,8 @@ sub _get_ccl_properties { > phr 4=1 > fuzzy 5=103 > ccode 1=8009 >+ nb 1=7 >+ ns 1=8 > ); > return $config; > } >@@ -148,6 +150,7 @@ subtest "test weighted not-autotruncated" => sub { > > t::lib::Mocks::mock_preference('QueryWeightFields', '1'); > t::lib::Mocks::mock_preference('QueryAutoTruncate', '0'); >+ t::lib::Mocks::mock_preference('QueryFuzzy', '1'); > > my $config = _get_ccl_properties(); > my $operators = [""]; >@@ -328,3 +331,75 @@ subtest "one and two weighted autotruncated" => sub { > is($ccl_errpos,0); > Net::Z3950::ZOOM::query_destroy($q); > }; >+ >+subtest "test with ISBN variations" => sub { >+ plan tests => 12; >+ >+ my $config = _get_ccl_properties(); >+ my $operators = [""]; >+ my $operands = ["1565926994"]; >+ my $indexes = ["nb"]; >+ my $limits = [""]; >+ my $sort_by = [""]; >+ my ($scan,$lang); >+ >+ foreach my $sample ( >+ { state => 0, query => 'nb=(rk=(1565926994)) ' }, >+ { state => 1, query => 'kw,wrdl=(rk=((nb=1-56592-699-4 OR nb=1-56592-699-4 OR nb=978-1-56592-699-8 OR nb=1565926994 OR nb=9781565926998))) ' }) >+ { >+ t::lib::Mocks::mock_preference('SearchWithISBNVariations', $sample->{state}); >+ # Test with disabled variatioms >+ my ($error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$query_type) = >+ C4::Search::buildQuery($operators,$operands,$indexes,$limits,$sort_by,$scan,$lang); >+ say 'Q: > ', $query; >+ is($error,undef,"Error is correct"); >+ is($query,$sample->{query},'Search ISBN when variations is '.$sample->{state}); >+ my $q = Net::Z3950::ZOOM::query_create(); >+ my ($ccl_errcode, $ccl_errstr, $ccl_errpos) = (0,"",0); >+ my $res = Net::Z3950::ZOOM::query_ccl2rpn($q, $query, $config, >+ $ccl_errcode, $ccl_errstr, $ccl_errpos >+ ); >+ is($res,0,"created CCL2RPN query"); >+ is($ccl_errcode,0); >+ is($ccl_errstr,""); >+ is($ccl_errpos,0); >+ Net::Z3950::ZOOM::query_destroy($q); >+ } >+ >+}; >+ >+subtest "test with ISSN variations" => sub { >+ plan tests => 12; >+ >+ my $config = _get_ccl_properties(); >+ my $operators = [""]; >+ my $operands = ["2434561X"]; >+ my $indexes = ["ns"]; >+ my $limits = [""]; >+ my $sort_by = [""]; >+ my ($scan,$lang); >+ >+ foreach my $sample ( >+ { state => 0, query => 'ns=(rk=(2434561X)) ' }, >+ { state => 1, query => 'kw,wrdl=(rk=((ns=2434-561X OR ns=2434561X))) ' }) >+ { >+ t::lib::Mocks::mock_preference('SearchWithISSNVariations', $sample->{state}); >+ # Test with disabled variatioms >+ my ($error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$query_type) = >+ C4::Search::buildQuery($operators,$operands,$indexes,$limits,$sort_by,$scan,$lang); >+ say 'Q: > ', $query; >+ is($error,undef,"Error is correct"); >+ is($query,$sample->{query},'Search ISSN when variations is '.$sample->{state}); >+ my $q = Net::Z3950::ZOOM::query_create(); >+ my ($ccl_errcode, $ccl_errstr, $ccl_errpos) = (0,"",0); >+ my $res = Net::Z3950::ZOOM::query_ccl2rpn($q, $query, $config, >+ $ccl_errcode, $ccl_errstr, $ccl_errpos >+ ); >+ is($res,0,"created CCL2RPN query"); >+ is($ccl_errcode,0); >+ is($ccl_errstr,""); >+ is($ccl_errpos,0); >+ Net::Z3950::ZOOM::query_destroy($q); >+ } >+ >+}; >-- >2.35.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 23919
:
134381
|
134382
|
134383
|
134384
|
134385
|
134422
|
134423
|
134424
|
134425
|
134426
|
134440
|
134441
|
134442
|
134443
|
134444
|
135288
|
135289
|
135290
|
135291
|
135292
|
138311
|
138312
|
138313
|
138314
|
138315
|
138480