| 1 | use Wiki::Toolkit::Setup::SQLite; |
|---|
| 2 | use OpenGuides; |
|---|
| 3 | use OpenGuides::Test; |
|---|
| 4 | use Test::More tests => 2; |
|---|
| 5 | |
|---|
| 6 | eval { require DBD::SQLite; }; |
|---|
| 7 | my $have_sqlite = $@ ? 0 : 1; |
|---|
| 8 | |
|---|
| 9 | SKIP: { |
|---|
| 10 | skip "DBD::SQLite not installed - no database to test with", 2 |
|---|
| 11 | unless $have_sqlite; |
|---|
| 12 | |
|---|
| 13 | Wiki::Toolkit::Setup::SQLite::cleardb( { dbname => "t/node.db" } ); |
|---|
| 14 | Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); |
|---|
| 15 | my $config = OpenGuides::Test->make_basic_config; |
|---|
| 16 | $config->script_name( "mywiki.cgi" ); |
|---|
| 17 | $config->script_url( "http://example.com/" ); |
|---|
| 18 | my $guide = OpenGuides->new( config => $config ); |
|---|
| 19 | |
|---|
| 20 | $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"; |
|---|
| 21 | my %data = $guide->wiki->retrieve_node( "South Croydon Station" ); |
|---|
| 22 | $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"; |
|---|
| 23 | |
|---|
| 24 | my $output = $guide->display_node( |
|---|
| 25 | id => "South Croydon Station", |
|---|
| 26 | version => 1, |
|---|
| 27 | return_output => 1, |
|---|
| 28 | ); |
|---|
| 29 | like( $output, qr'South_Croydon_Station', |
|---|
| 30 | "node param escaped properly in links in historic view" ); |
|---|
| 31 | unlike( $output, qr'South%20Croydon%20Station', |
|---|
| 32 | "...in all links" ); |
|---|
| 33 | } |
|---|