|
Revision 603, 1.2 kB
(checked in by kake, 4 years ago)
|
|
Oops, this should be in CVS.
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 | use CGI::Wiki::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 | plan skip_all => "DBD::SQLite not installed"; |
|---|
| 11 | exit 0; |
|---|
| 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 | CGI::Wiki::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" ); |
|---|