Bugzilla – Attachment 149029 Details for
Bug 32648
Search.t is failing if run after Filter_MARC_ViewPolicy.t
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32648: Avoid skipping record or hiding item
Bug-32648-Avoid-skipping-record-or-hiding-item.patch (text/plain), 3.49 KB, created by
Tomás Cohen Arazi
on 2023-03-31 11:07:41 UTC
(
hide
)
Description:
Bug 32648: Avoid skipping record or hiding item
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi
Created:
2023-03-31 11:07:41 UTC
Size:
3.49 KB
patch
obsolete
>From 95dc11219dcdba58856ff4c81e2976cf30049f1c Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 31 Mar 2023 10:44:45 +0000 >Subject: [PATCH] Bug 32648: Avoid skipping record or hiding item > >It seems that depending on other tests, the item could be hidden from the record, or >the entire record hidden because of the way we count hidden items. > >I add a mock for the two HIddenItems prefs and hardcode an xml record >to avoid problematic data from test builder > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/Search.t | 51 ++++++++++++++++++++++++++++++++++++++++++++++----- > 1 file changed, 46 insertions(+), 5 deletions(-) > >diff --git a/t/Search.t b/t/Search.t >index 9eaf5baa1fc..a6fed41af31 100755 >--- a/t/Search.t >+++ b/t/Search.t >@@ -189,18 +189,59 @@ subtest "searchResults PassItemMarcToXSLT test" => sub { > > my $builder = t::lib::TestBuilder->new; > >- my $item = $builder->build_sample_item(); >- my $record = $item->biblio->metadata->record({ embed_items => 1 }); >- >+ my $xml_record = q{ >+<record >+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >+ xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd" >+ xmlns="http://www.loc.gov/MARC21/slim"> >+ >+ <leader>00144 a2200073 4500</leader> >+ <datafield tag="245" ind1=" " ind2=" "> >+ <subfield code="a">Some boring read</subfield> >+ </datafield> >+ <datafield tag="100" ind1=" " ind2=" "> >+ <subfield code="a">Some boring author</subfield> >+ </datafield> >+ <datafield tag="942" ind1=" " ind2=" "> >+ <subfield code="c">gOlAIZMF</subfield> >+ </datafield> >+ <datafield tag="952" ind1=" " ind2=" "> >+ <subfield code="0">0</subfield> >+ <subfield code="1">0</subfield> >+ <subfield code="4">0</subfield> >+ <subfield code="7">0</subfield> >+ <subfield code="9">1117</subfield> >+ <subfield code="a">D6C8Pj</subfield> >+ <subfield code="b">D6C8Pj</subfield> >+ <subfield code="d">2023-03-31</subfield> >+ <subfield code="l">0</subfield> >+ <subfield code="p">g57ad1Zn3NOYZ</subfield> >+ <subfield code="r">2023-03-31</subfield> >+ <subfield code="w">2023-03-31</subfield> >+ <subfield code="y">gOlAIZMF</subfield> >+ </datafield> >+ <datafield tag="999" ind1=" " ind2=" "> >+ <subfield code="c">553</subfield> >+ <subfield code="d">553</subfield> >+ </datafield> >+</record> >+}; > t::lib::Mocks::mock_preference('PassItemMarcToXSLT','1'); > >- warnings_like { C4::Search::searchResults({ interface => "opac" },"test",1,1,0,0,[ $record->as_xml_record ] ,undef) } >+ # The routine uses a count of items in DB to determine if record should be hidden. >+ # Our item is not in the DB, so we avoid hiding the record which would >+ # mean we don't call XSLTParse4Display. >+ # Also ensure item is not hidden >+ t::lib::Mocks::mock_preference('OpacHiddenItems',''); >+ t::lib::Mocks::mock_preference('OpacHiddenItemsHidesRecord','0'); >+ >+ warnings_like { C4::Search::searchResults({ interface => "opac" },"test",1,1,0,0,[ $xml_record ] ,undef) } > [qr/Item here/], > "Item field returned from default XSLT if pref set"; > > t::lib::Mocks::mock_preference('PassItemMarcToXSLT','0'); > >- warnings_like { C4::Search::searchResults({ interface => "opac" },"test",1,1,0,0,[ $record->as_xml_record ] ,undef) } >+ warnings_like { C4::Search::searchResults({ interface => "opac" },"test",1,1,0,0,[ $xml_record ] ,undef) } > [qr/No item/], > "Item field returned from default XSLT if pref set"; > >-- >2.40.0
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 32648
:
149026
| 149029 |
151199
|
151239
|
151243