Bugzilla – Attachment 104707 Details for
Bug 24458
Search results don't use Koha::Filter::MARC::ViewPolicy
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24458: Regression tests
Bug-24458-Regression-tests.patch (text/plain), 2.95 KB, created by
Victor Grousset/tuxayo
on 2020-05-11 16:38:58 UTC
(
hide
)
Description:
Bug 24458: Regression tests
Filename:
MIME Type:
Creator:
Victor Grousset/tuxayo
Created:
2020-05-11 16:38:58 UTC
Size:
2.95 KB
patch
obsolete
>From b63df0add25d4370cbb5dddbe45aa4954a8f682e Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 11 May 2020 10:08:36 -0300 >Subject: [PATCH] Bug 24458: Regression tests > >This patch introduces tests for searchResults. The idea is to set a >subfield as hidden in OPAC and another on the staff interface, and see >if searchResults honours this on the XSLTResultsRecord contents. > >To test: >1. Apply this patch >2. Run: > $ kshell > k$ prove t/db_dependent/Search.t >=> FAIL: This is not really implemented > >https://bugs.koha-community.org/show_bug.cgi?id=25416 > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> >--- > t/db_dependent/Search.t | 50 ++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 49 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Search.t b/t/db_dependent/Search.t >index 771a7f4588..17c36434a2 100644 >--- a/t/db_dependent/Search.t >+++ b/t/db_dependent/Search.t >@@ -504,6 +504,54 @@ ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],' > > like( $newresults[0]->{XSLTResultsRecord}, qr/<variable name="anonymous_session">1<\/variable>/, "Variable injected correctly" ); > >+ my $biblio_id = $newresults[0]->{biblionumber}; >+ my $fw = C4::Biblio::GetFrameworkCode($biblio_id); >+ >+ my $dbh = C4::Context->dbh; >+ # Hide subfield 'p' in OPAC >+ $dbh->do(qq{ >+ UPDATE marc_subfield_structure >+ SET hidden=4 >+ WHERE frameworkcode='$fw' AND >+ tagfield=952 AND >+ tagsubfield='p'; >+ }); >+ >+ # Hide subfield 'y' in Staff >+ $dbh->do(qq{ >+ UPDATE marc_subfield_structure >+ SET hidden=-7 >+ WHERE frameworkcode='$fw' AND >+ tagfield=952 AND >+ tagsubfield='y'; >+ }); >+ >+ Koha::Caches->get_instance->flush_all; >+ >+ @newresults = searchResults( >+ { 'interface' => 'opac' }, >+ $query_desc, >+ $results_hashref->{'biblioserver'}->{'hits'}, >+ 17, >+ 0, >+ 0, >+ $results_hashref->{'biblioserver'}->{"RECORDS"} >+ ); >+ >+ unlike( $newresults[0]->{XSLTResultsRecord}, qr/<subfield code="p">TEST11111<\/subfield>/, '952\$p hidden in OPAC' ); >+ >+ @newresults = searchResults( >+ { 'interface' => 'intranet' }, >+ $query_desc, >+ $results_hashref->{'biblioserver'}->{'hits'}, >+ 17, >+ 0, >+ 0, >+ $results_hashref->{'biblioserver'}->{"RECORDS"} >+ ); >+ >+ unlike( $newresults[0]->{XSLTResultsRecord}, qr/<subfield code="y">Books<\/subfield>/, '952\$y hidden on staff interface' ); >+ > ( $error, $query, $simple_query, $query_cgi, > $query_desc, $limit, $limit_cgi, $limit_desc, > $query_type ) = buildQuery([], [ 'pqf=@attr 1=_ALLRECORDS @attr 2=103 ""' ], [], [], [], 0, 'en'); >@@ -853,7 +901,7 @@ sub run_unimarc_search_tests { > } > > subtest 'MARC21 + DOM' => sub { >- plan tests => 85; >+ plan tests => 87; > run_marc21_search_tests(); > }; > >-- >2.26.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 24458
:
104696
|
104697
|
104707
|
104708
|
104765
|
104766