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

Last change on this file since 812 was 804, checked in by Dominic Hargreaves, 15 years ago

test fix for wiki::toolkit change (we won't be releasing quite yet then)

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