# Copyright (c) 2006 bivio Software, Inc. All Rights Reserved. # # Visit http://www.bivio.biz for more info. # # This library is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation; either version 2.1 of the # License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; If not, you may get a copy from: # http://www.opensource.org/licenses/lgpl-license.html # # $Id: SearchList.bunit,v 1.7 2009/06/22 20:45:06 nagler Exp $ Request('initialize_fully'); my($files) = require('../../../Search/t/xapian.PL'); Bivio::Type->get_instance('AccessMode')->execute_private(req()); my($cases) = sub { my($page, $ids, $prev, $next) = @_; return ( ({ method => 'load_page', check_return => sub { my($case, $actual, $expect) = @_; $case->actual_return([sort(@{ $case->get('object') ->map_rows(sub {shift->get('primary_id')}) })]); return [sort(map($files->[$_], @$expect))]; }, } => [ [$page ? { page_number => $page, count => 2, search => 'albeit', } : ()] => $ids, ], get_query => sub { my($case, $actual) = @_; $case->actual_return([$actual->[0]->get(qw(has_prev has_next))]); return [$prev, $next]; }), ); }; [ inline_case(sub { req()->set_realm_and_user(qw(xapian_demo xapian_guest)); }), [req()] => [ map($cases->(@$_), [0, [], 0, 0], [1, [0, 5], 0, 1], [2, [1, 2], 1, 1], [3, [3, 4], 1, 0], ), ], inline_case(sub { req()->set_user(qw(xapian_withdrawn)); }), [req()] => [ map($cases->(@$_), [0, [], 0, 0], [1, [5], 0, 0], ), ], ];