File: 607_bug_first_version.t

package info (click to toggle)
openguides 0.84-1.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,628 kB
  • sloc: perl: 4,812; sh: 56; javascript: 56; makefile: 19
file content (38 lines) | stat: -rw-r--r-- 1,239 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use strict;
use Wiki::Toolkit::Setup::SQLite;
use OpenGuides::Config;
use OpenGuides;
use OpenGuides::Template;
use OpenGuides::Test;
use Test::More;

eval { require DBD::SQLite; };
if ( $@ ) {
    my ($error) = $@ =~ /^(.*?)\n/;
    plan skip_all => "DBD::SQLite could not be used - no database to test with ($error)";
}

plan tests => 3;

# Clear out the database from any previous runs.
    OpenGuides::Test::refresh_db();


my $config = OpenGuides::Test->make_basic_config;
my $guide = OpenGuides->new( config => $config );

OpenGuides::Test->write_data(
                              guide => $guide,
                              node  => "A Node",
);

# Test that we can list all versions of a node that only has one version.
eval { $guide->list_all_versions( id => "A Node", return_output => 1 ); };
is( $@, "", "->list_all_versions doesn't croak when only one version" );

# Test that node with only one version doesn't display diff link.
my $output = $guide->display_node( id => "A Node", return_output => 1 );
unlike( $output, qr|<a href=".*">diff</a>|,
        "no diff link displayed on node with only one version" );
unlike( $output, qr|<a href=".*">View current version.</a>|i,
        "...nor view current version link" );