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

Last change on this file since 174 was 174, checked in by kake, 19 years ago

Fixed OpenGuides::Utils to take note of dbhost. Bumped version number.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.1 KB
Line 
1use strict;
2use Config::Tiny;
3use Test::More tests => 9;
4
5# Need to use a BEGIN block for the test or we get "Too late to run INIT block"
6# from Class::Delegation
7
8BEGIN {
9  use_ok( "OpenGuides::Utils" );
10}
11
12eval { my $wiki = OpenGuides::Utils->make_wiki_object; };
13ok( $@, "->make_wiki_object croaks if no config param supplied" );
14
15eval { my $wiki = OpenGuides::Utils->make_wiki_object( config => "foo" ); };
16ok( $@, "...and if config param isn't a Config::Tiny object" );
17
18my $config = Config::Tiny->read( "wiki.conf" )
19    or die "Couldn't read wiki.conf";
20my $wiki = eval { OpenGuides::Utils->make_wiki_object( config => $config ); };
21is( $@, "", "...but not if a Config::Tiny object is supplied" );
22isa_ok( $wiki, "CGI::Wiki" );
23
24ok( $wiki->store,      "...and store defined" );
25ok( $wiki->search_obj, "...and search defined" );
26ok( $wiki->formatter,  "...and formatter defined" );
27
28# Ensure that we take note of any defined dbhost - note that this test
29# is only useful if we've defined a dbhost during perl Build.PL
30is( $wiki->store->dbhost, $config->{_}->{dbhost}, "dbhost taken note of" );
Note: See TracBrowser for help on using the repository browser.