Bugzilla – Attachment 138315 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 Items search by ISBN and ISSN with variations
Bug-23919-Add-tests-for-Items-search-by-ISBN-and-I.patch (text/plain), 3.06 KB, created by
Kyle M Hall (khall)
on 2022-07-29 13:23:51 UTC
(
hide
)
Description:
Bug 23919: Add tests for Items search by ISBN and ISSN with variations
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2022-07-29 13:23:51 UTC
Size:
3.06 KB
patch
obsolete
>From cf3e718c7ec84c08aab0f7d7a457cf8a8232caf7 Mon Sep 17 00:00:00 2001 >From: Slava Shishkin <slavashishkin@gmail.com> >Date: Fri, 29 Apr 2022 12:10:54 +0300 >Subject: [PATCH] Bug 23919: Add tests for Items search by ISBN and ISSN with > variations > >(sysprefs SearchWithISBNVariations/SearchWithISSNVariations) > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > t/db_dependent/Items.t | 49 +++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 48 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Items.t b/t/db_dependent/Items.t >index 36593268305..c39a0b963f3 100755 >--- a/t/db_dependent/Items.t >+++ b/t/db_dependent/Items.t >@@ -309,7 +309,7 @@ subtest q{Test Koha::Database->schema()->resultset('Item')->itemtype()} => sub { > }; > > subtest 'SearchItems test' => sub { >- plan tests => 19; >+ plan tests => 20; > > $schema->storage->txn_begin; > my $dbh = C4::Context->dbh; >@@ -567,6 +567,53 @@ subtest 'SearchItems test' => sub { > ($items, $total_results) = SearchItems($filter,$params); > is($items->[0]->{barcode}, $item1->barcode, 'Items sorted as expected by availability'); > >+ subtest 'Search items by ISSN and ISBN with variations' => sub { >+ plan tests => 4; >+ >+ my $marc_record = MARC::Record->new; >+ # Prepare ISBN for biblio: >+ $marc_record->append_fields( MARC::Field->new( '020', '', '', 'a' => '9780136019701' ) ); >+ # Prepare ISSN for biblio: >+ $marc_record->append_fields( MARC::Field->new( '022', '', '', 'a' => '2434561X' ) ); >+ my ( $isbnissn_biblionumber ) = AddBiblio( $marc_record, '' ); >+ my $isbnissn_biblio = Koha::Biblios->find($isbnissn_biblionumber); >+ >+ my $item = $builder->build_sample_item( >+ { >+ biblionumber => $isbnissn_biblio->biblionumber, >+ } >+ ); >+ my $item_itemnumber = $item->itemnumber; >+ >+ my $filter_isbn = { >+ field => 'isbn', >+ query => '978013-6019701', >+ operator => 'like', >+ }; >+ >+ t::lib::Mocks::mock_preference('SearchWithISBNVariations', 0); >+ ($items, $total_results) = SearchItems($filter_isbn); >+ is($total_results, 0, "Search items finds ISBN, no variations"); >+ >+ t::lib::Mocks::mock_preference('SearchWithISBNVariations', 1); >+ ($items, $total_results) = SearchItems($filter_isbn); >+ is($total_results, 1, "Search items finds ISBN with variations"); >+ >+ my $filter_issn = { >+ field => 'issn', >+ query => '2434-561X', >+ operator => 'like', >+ }; >+ >+ t::lib::Mocks::mock_preference('SearchWithISSNVariations', 0); >+ ($items, $total_results) = SearchItems($filter_issn); >+ is($total_results, 0, "Search items finds ISSN, no variations"); >+ >+ t::lib::Mocks::mock_preference('SearchWithISSNVariations', 1); >+ ($items, $total_results) = SearchItems($filter_issn); >+ is($total_results, 1, "Search items finds ISSN with variations"); >+ }; >+ > $schema->storage->txn_rollback; > }; > >-- >2.30.2
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