| 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 | |
|---|
| 9 | if ( $@ ) { |
|---|
| 10 | my ($error) = $@ =~ /^(.*?)\n/; |
|---|
| 11 | plan skip_all => "DBD::SQLite could not be used - no database to test with ($error)"; |
|---|
| 12 | } |
|---|
| 13 | |
|---|
| 14 | plan tests => 1; |
|---|
| 15 | |
|---|
| 16 | Wiki::Toolkit::Setup::SQLite::cleardb( { dbname => "t/node.db" } ); |
|---|
| 17 | Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); |
|---|
| 18 | my $config = OpenGuides::Config->new( |
|---|
| 19 | vars => { |
|---|
| 20 | dbtype => "sqlite", |
|---|
| 21 | dbname => "t/node.db", |
|---|
| 22 | indexing_directory => "t/indexes", |
|---|
| 23 | script_url => "http://wiki.example.com/", |
|---|
| 24 | script_name => "mywiki.cgi", |
|---|
| 25 | site_name => "Wiki::Toolkit Test Site", |
|---|
| 26 | template_path => cwd . "/templates", |
|---|
| 27 | } |
|---|
| 28 | ); |
|---|
| 29 | eval { require Wiki::Toolkit::Search::Plucene; }; |
|---|
| 30 | if ( $@ ) { $config->use_plucene ( 0 ) }; |
|---|
| 31 | |
|---|
| 32 | my $guide = OpenGuides->new( config => $config ); |
|---|
| 33 | |
|---|
| 34 | $guide->wiki->write_node( "South Croydon Station", "A sleepy main-line station in what is arguably the nicest part of Croydon.", undef, { comment => "<myfaketag>" } ) or die "Can't write node"; |
|---|
| 35 | my %data = $guide->wiki->retrieve_node( "South Croydon Station" ); |
|---|
| 36 | $guide->wiki->write_node( "South Croydon Station", "A sleepy main-line station in what is arguably the nicest part of Croydon.", $data{checksum}, { comment => "<myfaketag>" } ) or die "Can't write node"; |
|---|
| 37 | |
|---|
| 38 | my $output = $guide->list_all_versions( |
|---|
| 39 | id => "South Croydon Station", |
|---|
| 40 | return_output => 1, |
|---|
| 41 | ); |
|---|
| 42 | unlike( $output, qr'<myfaketag>', "HTML escaped in comments" ); |
|---|