|
Revision 956, 1.6 kB
(checked in by earle, 20 months ago)
|
|
Complete transition to using skip_all (remove old SKIP blocks).
More verbose reporting for error "require"ing DBD::SQLite.
|
| Line | |
|---|
| 1 | use strict; |
|---|
| 2 | use OpenGuides; |
|---|
| 3 | use OpenGuides::Test; |
|---|
| 4 | use Test::More; |
|---|
| 5 | use Wiki::Toolkit::Setup::SQLite; |
|---|
| 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 | eval { require Test::HTML::Content; }; |
|---|
| 14 | if ( $@ ) { |
|---|
| 15 | plan skip_all => "Test::HTML::Content not installed"; |
|---|
| 16 | } |
|---|
| 17 | |
|---|
| 18 | plan tests => 1; |
|---|
| 19 | |
|---|
| 20 | # Clear out the database from any previous runs. |
|---|
| 21 | unlink "t/node.db"; |
|---|
| 22 | unlink <t/indexes/*>; |
|---|
| 23 | Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); |
|---|
| 24 | |
|---|
| 25 | my $config = OpenGuides::Test->make_basic_config; |
|---|
| 26 | my $guide = OpenGuides->new( config => $config ); |
|---|
| 27 | my $wiki = $guide->wiki; |
|---|
| 28 | |
|---|
| 29 | my $q = OpenGuides::Test->make_cgi_object( |
|---|
| 30 | content => "I am some content.", |
|---|
| 31 | summary => "I am a summary.", |
|---|
| 32 | ); |
|---|
| 33 | |
|---|
| 34 | # Get a checksum for a "blank" node. |
|---|
| 35 | my %node_data = $wiki->retrieve_node( "Clapham Junction Station" ); |
|---|
| 36 | $q->param( -name => "checksum", -value => $node_data{checksum} ); |
|---|
| 37 | |
|---|
| 38 | my $output = $guide->preview_edit( |
|---|
| 39 | id => "Clapham Junction Station", |
|---|
| 40 | cgi_obj => $q, |
|---|
| 41 | return_output => 1, |
|---|
| 42 | ); |
|---|
| 43 | |
|---|
| 44 | # Strip Content-Type header to stop Test::HTML::Content getting confused. |
|---|
| 45 | $output =~ s/^Content-Type.*[\r\n]+//m; |
|---|
| 46 | |
|---|
| 47 | Test::HTML::Content::text_ok( $output, "I am a summary.", |
|---|
| 48 | "Summary shows up in preview." ); |
|---|