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 Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
009007b809
commit
0524f3b6d6
|
|
@ -503,6 +503,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');
|
||||
|
|
@ -852,7 +900,7 @@ sub run_unimarc_search_tests {
|
|||
}
|
||||
|
||||
subtest 'MARC21 + DOM' => sub {
|
||||
plan tests => 85;
|
||||
plan tests => 87;
|
||||
run_marc21_search_tests();
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue