source: trunk/t/34_supersearch_paging.t @ 565

Last change on this file since 565 was 565, checked in by kake, 17 years ago

Take out some more common testing code into OpenGuides::Test - make_basic_config

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.7 KB
Line 
1use strict;
2use CGI::Wiki::Setup::SQLite;
3use Config::Tiny;
4use OpenGuides::SuperSearch;
5use OpenGuides::Test;
6use Test::More;
7
8eval { require DBD::SQLite; };
9if ( $@ ) {
10    plan skip_all => "DBD::SQLite not installed";
11}
12
13eval { require Plucene; };
14if ( $@ ) {
15    plan skip_all => "Plucene not installed";
16}
17
18eval { require Geography::NationalGrid::GB; };
19if ( $@ ) {
20    plan skip_all => "Geography::NationalGrid::GB not installed";
21}
22
23plan tests => 1;
24
25# Clear out the database from any previous runs.
26unlink "t/node.db";
27unlink <t/indexes/*>;
28
29CGI::Wiki::Setup::SQLite::setup( { dbname => "t/node.db" } );
30my $config = OpenGuides::Test->make_basic_config;
31$config->{_}{use_plucene} = 1;
32$config->{_}{script_name} = "wiki.cgi";
33$config->{_}{script_url} = "http://example.com/";
34
35my $search = OpenGuides::SuperSearch->new( config => $config );
36my $guide = OpenGuides->new( config => $config );
37
38foreach my $i ( 1 .. 30 ) {
39    OpenGuides::Test->write_data(
40                                  guide      => $guide,
41                                  node       => "Crabtree Tavern $i",
42                                  os_x       => 523465,
43                                  os_y       => 177490,
44                                  categories => "Pubs",
45                                );
46}
47
48my $output = $search->run(
49                           return_output => 1,
50                           vars          => {
51                                              os_dist => 1500,
52                                              os_x => 523500,
53                                              os_y => 177500,
54                                            },
55                         );
56like( $output, qr/supersearch.cgi\?.*os_x=523500.*Next.*results/s,
57      "os_x retained in next page link" );
Note: See TracBrowser for help on using the repository browser.