|
Revision 594, 1.3 kB
(checked in by dom, 4 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
|
| Line | |
|---|
| 1 | use strict; |
|---|
| 2 | use OpenGuides::Config; |
|---|
| 3 | use OpenGuides::Utils; |
|---|
| 4 | use Test::More tests => 7; |
|---|
| 5 | |
|---|
| 6 | eval { my $wiki = OpenGuides::Utils->make_wiki_object; }; |
|---|
| 7 | ok( $@, "->make_wiki_object croaks if no config param supplied" ); |
|---|
| 8 | |
|---|
| 9 | eval { my $wiki = OpenGuides::Utils->make_wiki_object( config => "foo" ); }; |
|---|
| 10 | ok( $@, "...and if config param isn't an OpenGuides::Config object" ); |
|---|
| 11 | |
|---|
| 12 | eval { require DBD::SQLite; }; |
|---|
| 13 | my $have_sqlite = $@ ? 0 : 1; |
|---|
| 14 | |
|---|
| 15 | SKIP: { |
|---|
| 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 | } |
|---|