|
Revision 956, 1.3 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 OpenGuides; |
|---|
| 4 | use OpenGuides::Template; |
|---|
| 5 | use OpenGuides::Test; |
|---|
| 6 | use Test::More; |
|---|
| 7 | |
|---|
| 8 | eval { require DBD::SQLite; }; |
|---|
| 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 => 3; |
|---|
| 15 | |
|---|
| 16 | # Clear out the database from any previous runs. |
|---|
| 17 | unlink "t/node.db"; |
|---|
| 18 | unlink <t/indexes/*>; |
|---|
| 19 | Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); |
|---|
| 20 | |
|---|
| 21 | my $config = OpenGuides::Test->make_basic_config; |
|---|
| 22 | my $guide = OpenGuides->new( config => $config ); |
|---|
| 23 | |
|---|
| 24 | OpenGuides::Test->write_data( |
|---|
| 25 | guide => $guide, |
|---|
| 26 | node => "A Node", |
|---|
| 27 | ); |
|---|
| 28 | |
|---|
| 29 | # Test that we can list all versions of a node that only has one version. |
|---|
| 30 | eval { $guide->list_all_versions( id => "A Node", return_output => 1 ); }; |
|---|
| 31 | is( $@, "", "->list_all_versions doesn't croak when only one version" ); |
|---|
| 32 | |
|---|
| 33 | # Test that node with only one version doesn't display diff link. |
|---|
| 34 | my $output = $guide->display_node( id => "A Node", return_output => 1 ); |
|---|
| 35 | unlike( $output, qr|<a href=".*">diff</a>|, |
|---|
| 36 | "no diff link displayed on node with only one version" ); |
|---|
| 37 | unlike( $output, qr|<a href=".*">View current version.</a>|i, |
|---|
| 38 | "...nor view current version link" ); |
|---|