]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/perlmods/t/19-OpenILS-WWW-EGCatLoader.t
LP1615805 No inputs after submit in patron search (AngularJS)
[Evergreen.git] / Open-ILS / src / perlmods / t / 19-OpenILS-WWW-EGCatLoader.t
1 #!perl -T
2
3 use Test::More tests => 11;
4 use CGI;
5
6 BEGIN {
7         use_ok( 'OpenILS::WWW::EGCatLoader' );
8 }
9 use_ok( 'OpenILS::WWW::EGCatLoader::Account' );
10 use_ok( 'OpenILS::WWW::EGCatLoader::Container' );
11 use_ok( 'OpenILS::WWW::EGCatLoader::Record' );
12 use_ok( 'OpenILS::WWW::EGCatLoader::Search' );
13 use_ok( 'OpenILS::WWW::EGCatLoader::Util' );
14
15 my $ctx = {};
16 my $cgi = CGI->new();
17 $cgi->param('query', 'sort(titlesort) cats site(CONS)');
18 $cgi->param('sort',  '');
19 $cgi->param('depth', 0);
20 my ($user_query, $query, $site, $depth) = OpenILS::WWW::EGCatLoader::_prepare_biblio_search($cgi, $ctx);
21 is($user_query, 'sort(titlesort) cats site(CONS)', 'LP#100504: user query left as is');
22 is($site,  'CONS', 'successfully parsed site');
23 is($depth, '0',    'successfully parsed depth');
24 is($query,  'cats site(CONS) depth(0)', 'LP#1562153: change sort order to relevance');
25
26 # test date filter
27 $cgi->param('pubdate', 'is');
28 $cgi->param('date1', '1999');
29 ($user_query, $query, $site, $depth) = OpenILS::WWW::EGCatLoader::_prepare_biblio_search($cgi, $ctx);
30 is($query, 'date1(1999)  cats site(CONS) depth(0)', 'LP#1005040: "is" pubdate filter mapped to date1() filter');