Show
Ignore:
Timestamp:
06/07/04 21:39:35 (5 years ago)
Author:
kake
Message:

Test overhaul - no longer require database access info.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/t/61_bug_textareas.t

    r230 r361  
    1 use strict; 
     1use CGI::Wiki::Setup::SQLite; 
    22use Config::Tiny; 
    33use Cwd; 
     
    66use Test::More tests => 1; 
    77 
    8 ##### 
    9 ##### IMPORTANT: Treat this wiki object as read-only or we may eat live data. 
    10 ##### 
     8eval { require DBD::SQLite; }; 
     9my $have_sqlite = $@ ? 0 : 1; 
    1110 
    12 my $config = Config::Tiny->read( "wiki.conf" ) 
    13     or die "Couldn't read wiki.conf"; 
    14 my $wiki = OpenGuides::Utils->make_wiki_object( config => $config ); 
    15 $config->{_}{template_path} = cwd . "/templates"; 
     11SKIP: { 
     12    skip "DBD::SQLite not installed - no database to test with", 1 
     13      unless $have_sqlite; 
    1614 
    17 my $out = OpenGuides::Template->output( 
    18     wiki     => $wiki, 
    19     config   => $config, 
    20     template => "edit_form.tt", 
    21     vars     => { 
    22                   locales  => [ 
    23                                 { name => "Barville" }, 
    24                                 { name => "Fooville" }, 
    25                               ], 
    26                 }, 
    27 ); 
     15    CGI::Wiki::Setup::SQLite::setup( { dbname => "t/node.db" } ); 
     16    my $config = Config::Tiny->new; 
     17    $config->{_} = { 
     18                     dbtype             => "sqlite", 
     19                     dbname             => "t/node.db", 
     20                     indexing_directory => "t/indexes", 
     21                     script_url         => "http://wiki.example.com/", 
     22                     script_name        => "mywiki.cgi", 
     23                     site_name          => "CGI::Wiki Test Site", 
     24                     template_path      => cwd . "/templates", 
     25                   }; 
    2826 
    29 like( $out, qr/Barville\nFooville/, "locales properly separated in textarea" ); 
     27    my $wiki = OpenGuides::Utils->make_wiki_object( config => $config ); 
     28 
     29    my $out = OpenGuides::Template->output( 
     30        wiki     => $wiki, 
     31        config   => $config, 
     32        template => "edit_form.tt", 
     33        vars     => { 
     34                      locales  => [ 
     35                                    { name => "Barville" }, 
     36                                    { name => "Fooville" }, 
     37                                  ], 
     38                    }, 
     39    ); 
     40 
     41    like( $out, qr/Barville\nFooville/, 
     42         "locales properly separated in textarea" ); 
     43} 
    3044 
    3145