source: trunk/t/11_utils.t @ 730

Last change on this file since 730 was 594, checked in by Dominic Hargreaves, 17 years ago

Update tests so they pass without Plucene installed again (was affected by
config rejig).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.3 KB
Line 
1use strict;
2use OpenGuides::Config;
3use OpenGuides::Utils;
4use Test::More tests => 7;
5
6eval { my $wiki = OpenGuides::Utils->make_wiki_object; };
7ok( $@, "->make_wiki_object croaks if no config param supplied" );
8
9eval { my $wiki = OpenGuides::Utils->make_wiki_object( config => "foo" ); };
10ok( $@, "...and if config param isn't an OpenGuides::Config object" );
11
12eval { require DBD::SQLite; };
13my $have_sqlite = $@ ? 0 : 1;
14
15SKIP: {
16    skip "DBD::SQLite not installed - no database to test with", 5
17      unless $have_sqlite;
18
19    my $config = OpenGuides::Config->new(
20           vars => {
21                     dbtype             => "sqlite",
22                     dbname             => "t/node.db",
23                     indexing_directory => "t/indexes",
24                     script_url         => "",
25                     script_name        => "",
26                   }
27    );
28
29    eval { require CGI::Wiki::Search::Plucene; };
30    if ( $@ ) { $config->use_plucene ( 0 ) };
31
32    my $wiki = eval {
33        OpenGuides::Utils->make_wiki_object( config => $config );
34    };
35    is( $@, "",
36        "...but not with an OpenGuides::Config object with suitable data" );
37    isa_ok( $wiki, "CGI::Wiki" );
38
39    ok( $wiki->store,      "...and store defined" );
40    ok( $wiki->search_obj, "...and search defined" );
41    ok( $wiki->formatter,  "...and formatter defined" );
42}
Note: See TracBrowser for help on using the repository browser.