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

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

Test overhaul - no longer require database access info.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.2 KB
Line 
1use strict;
2use Config::Tiny;
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 a Config::Tiny 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 = Config::Tiny->new;
20    $config->{_} = {
21                     dbtype             => "sqlite",
22                     dbname             => "t/node.db",
23                     indexing_directory => "t/indexes",
24                     script_url         => "",
25                     script_name        => "",
26                   };
27
28    my $wiki = eval {
29        OpenGuides::Utils->make_wiki_object( config => $config );
30    };
31    is( $@, "",
32        "...but not if a Config::Tiny object with suitable data is supplied" );
33    isa_ok( $wiki, "CGI::Wiki" );
34
35    ok( $wiki->store,      "...and store defined" );
36    ok( $wiki->search_obj, "...and search defined" );
37    ok( $wiki->formatter,  "...and formatter defined" );
38}
Note: See TracBrowser for help on using the repository browser.