LP#1562153: add regression test
authorGalen Charlton <gmc@esilibrary.com>
Fri, 25 Mar 2016 20:44:15 +0000 (16:44 -0400)
committerMike Rylander <mrylander@gmail.com>
Thu, 28 Apr 2016 16:04:25 +0000 (12:04 -0400)
This patch adds a regression test for successfully
overrding the sort order in a query from a 'sort' CGI
parameter.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/perlmods/t/19-OpenILS-WWW-EGCatLoader.t

index dc57400..9d33829 100644 (file)
@@ -1,6 +1,7 @@
 #!perl -T
 
-use Test::More tests => 6;
+use Test::More tests => 9;
+use CGI;
 
 BEGIN {
        use_ok( 'OpenILS::WWW::EGCatLoader' );
@@ -10,3 +11,13 @@ use_ok( 'OpenILS::WWW::EGCatLoader::Container' );
 use_ok( 'OpenILS::WWW::EGCatLoader::Record' );
 use_ok( 'OpenILS::WWW::EGCatLoader::Search' );
 use_ok( 'OpenILS::WWW::EGCatLoader::Util' );
+
+my $ctx = {};
+my $cgi = CGI->new();
+$cgi->param('query', 'sort(titlesort) cats site(CONS)');
+$cgi->param('sort',  '');
+$cgi->param('depth', 0);
+my ($new_query, $site, $depth) = OpenILS::WWW::EGCatLoader::_prepare_biblio_search($cgi, $ctx);
+is($site,  'CONS', 'successfully parsed site');
+is($depth, '0',    'successfully parsed depth');
+is($new_query,  'cats site(CONS) depth(0)', 'LP#1562153: change sort order to relevance');