source: trunk/t/67_bug_first_version.t @ 1273

Last change on this file since 1273 was 1273, checked in by Dominic Hargreaves, 12 years ago

test cleanups for refreshing the test db (thanks bob) (fixes #271)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.2 KB
Line 
1use strict;
2use Wiki::Toolkit::Setup::SQLite;
3use OpenGuides::Config;
4use OpenGuides;
5use OpenGuides::Template;
6use OpenGuides::Test;
7use Test::More;
8
9eval { require DBD::SQLite; };
10if ( $@ ) {
11    my ($error) = $@ =~ /^(.*?)\n/;
12    plan skip_all => "DBD::SQLite could not be used - no database to test with ($error)";
13}
14
15plan tests => 3;
16
17# Clear out the database from any previous runs.
18    OpenGuides::Test::refresh_db();
19
20
21my $config = OpenGuides::Test->make_basic_config;
22my $guide = OpenGuides->new( config => $config );
23
24OpenGuides::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.
30eval { $guide->list_all_versions( id => "A Node", return_output => 1 ); };
31is( $@, "", "->list_all_versions doesn't croak when only one version" );
32
33# Test that node with only one version doesn't display diff link.
34my $output = $guide->display_node( id => "A Node", return_output => 1 );
35unlike( $output, qr|<a href=".*">diff</a>|,
36        "no diff link displayed on node with only one version" );
37unlike( $output, qr|<a href=".*">View current version.</a>|i,
38        "...nor view current version link" );
Note: See TracBrowser for help on using the repository browser.