source: trunk/t/37_search_summaries.t @ 878

Last change on this file since 878 was 785, checked in by Dominic Hargreaves, 16 years ago

Use Wiki::Toolkit. Note that CGI::Wiki::Plugin::Diff hasn't been converted yet,
so tests will be broken for now.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.8 KB
Line 
1use strict;
2use Wiki::Toolkit::Setup::SQLite;
3use OpenGuides::Config;
4use OpenGuides::Search;
5use Test::More;
6
7eval { require DBD::SQLite; };
8if ( $@ ) {
9    plan skip_all => "DBD::SQLite not installed";
10} else {
11    plan tests => 2;
12
13    # Clear out the database from any previous runs.
14    unlink "t/node.db";
15    unlink <t/indexes/*>;
16
17    Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
18    my $config = OpenGuides::Config->new(
19           vars => {
20                     dbtype             => "sqlite",
21                     dbname             => "t/node.db",
22                     indexing_directory => "t/indexes",
23                     script_name        => "wiki.cgi",
24                     script_url         => "http://example.com/",
25                     site_name          => "Test Site",
26                     template_path      => "./templates",
27                   }
28    );
29
30    # Plucene is the recommended searcher now.
31    eval { require Wiki::Toolkit::Search::Plucene; };
32    if ( $@ ) { $config->use_plucene( 0 ) };
33
34    my $search = OpenGuides::Search->new( config => $config );
35    isa_ok( $search, "OpenGuides::Search" );
36    my $wiki = $search->wiki;
37    $wiki->write_node( "Pub Crawls", "The basic premise of the pub crawl is to visit a succession of pubs, rather than spending the entire evening or day in a single establishment. London offers an excellent choice of themes for your pub crawl.", undef, { category => "Pubs" } ) or die "Can't write node";
38
39    my $output = $search->run(
40                               return_output => 1,
41                               vars          => { search => "pub" }
42                             );
43    SKIP: {
44        skip "TODO: summaries", 1;
45        like( $output, qr|<b>pub</b>|i,
46              "outputs at least one bolded occurence of 'pub'" );
47    } # end of SKIP
48}
Note: See TracBrowser for help on using the repository browser.