|
Revision 956, 1.5 kB
(checked in by earle, 22 months ago)
|
|
Complete transition to using skip_all (remove old SKIP blocks).
More verbose reporting for error "require"ing DBD::SQLite.
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 | use Wiki::Toolkit::Setup::SQLite; |
|---|
| 2 | use OpenGuides::Config; |
|---|
| 3 | use Cwd; |
|---|
| 4 | use OpenGuides; |
|---|
| 5 | use Test::More; |
|---|
| 6 | |
|---|
| 7 | eval { require DBD::SQLite; }; |
|---|
| 8 | if ( $@ ) { |
|---|
| 9 | my ($error) = $@ =~ /^(.*?)\n/; |
|---|
| 10 | plan skip_all => "DBD::SQLite could not be used - no database to test with ($error)"; |
|---|
| 11 | } |
|---|
| 12 | |
|---|
| 13 | plan tests => 1; |
|---|
| 14 | |
|---|
| 15 | Wiki::Toolkit::Setup::SQLite::cleardb( { dbname => "t/node.db" } ); |
|---|
| 16 | Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); |
|---|
| 17 | my $config = OpenGuides::Config->new( |
|---|
| 18 | vars => { |
|---|
| 19 | dbtype => "sqlite", |
|---|
| 20 | dbname => "t/node.db", |
|---|
| 21 | indexing_directory => "t/indexes", |
|---|
| 22 | script_url => "http://wiki.example.com/", |
|---|
| 23 | script_name => "mywiki.cgi", |
|---|
| 24 | site_name => "Wiki::Toolkit Test Site", |
|---|
| 25 | template_path => cwd . "/templates", |
|---|
| 26 | } |
|---|
| 27 | ); |
|---|
| 28 | eval { require Wiki::Toolkit::Search::Plucene; }; |
|---|
| 29 | if ( $@ ) { $config->use_plucene ( 0 ) }; |
|---|
| 30 | |
|---|
| 31 | my $guide = OpenGuides->new( config => $config ); |
|---|
| 32 | |
|---|
| 33 | $guide->wiki->write_node( "South Croydon Station", "A sleepy main-line station in what is arguably the nicest part of Croydon.", undef, { phone => "<hr><h1>hello mum</h1><hr>" } ) or die "Can't write node"; |
|---|
| 34 | |
|---|
| 35 | my $output = $guide->display_node( |
|---|
| 36 | id => "South Croydon Station", |
|---|
| 37 | return_output => 1, |
|---|
| 38 | ); |
|---|
| 39 | unlike( $output, qr'<hr><h1>hello mum</h1><hr>', |
|---|
| 40 | "HTML escaped in metadata on node display" ); |
|---|