Changeset 361 for trunk/t/15_template.t

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/15_template.t

    r311 r361  
    11use strict; 
    2 use Test::More tests => 28; 
    32use Config::Tiny; 
    43use Cwd; 
    54use CGI::Cookie; 
    65use CGI::Wiki::Formatter::UseMod; 
     6use OpenGuides::Template; 
    77use Test::MockObject; 
    8  
    9 use_ok( "OpenGuides::Template" ); 
    10  
    11 my $config = Config::Tiny->read( "t/21_wiki.conf" ); 
    12 $config->{_}->{template_path} = cwd . "/t/templates"; 
     8use Test::More tests => 27; 
     9 
     10my $config = Config::Tiny->new; 
     11$config->{_} = { 
     12                 template_path         => cwd . '/t/templates', 
     13                 site_name             => 'CGI::Wiki Test Site', 
     14                 script_url            => 'http://wiki.example.com/', 
     15                 script_name           => 'mywiki.cgi', 
     16                 default_country       => 'United Kingdom', 
     17                 default_city          => 'London', 
     18                 contact_email         => 'wiki@example.com', 
     19                 stylesheet_url        => 'http://wiki.example.com/styles.css', 
     20                 home_name             => 'Home Page', 
     21                 formatting_rules_node => 'Rules', 
     22               }; 
    1323 
    1424# White box testing - we know that OpenGuides::Template only actually uses 
    1525# the node_name_to_node_param method of the formatter component of the wiki 
    16 # object passed in, and I CBA to faff about with picking out the test DB 
    17 # info to make a proper wiki object here. 
     26# object passed in, and I CBA to make a proper wiki object here. 
    1827my $fake_wiki = Test::MockObject->new; 
    1928$fake_wiki->mock("formatter", 
     
    103112 
    104113# Test that home_link is set correctly when script_name is blank. 
    105 $config = Config::Tiny->read( "t/15_wiki.conf" ); 
    106 $config->{_}->{template_path} = cwd . "/t/templates"; 
     114$config->{_} = { 
     115                 template_path         => cwd . '/t/templates', 
     116                 site_name             => 'CGI::Wiki Test Site', 
     117                 script_url            => 'http://wiki.example.com/', 
     118                 script_name           => '', 
     119               }; 
    107120$output = OpenGuides::Template->output( 
    108121    wiki     => $fake_wiki, 
     
    115128# Test that full_cgi_url comes out right if the trailing '/' is 
    116129# missing from script_url in the config file. 
    117 $config = Config::Tiny->read( "t/15_wiki.conf" ); 
    118 $config->{_}->{template_path} = cwd . "/t/templates"; 
    119 $config->{_}->{script_url} = "http://wiki.example.com"; 
    120 $config->{_}->{script_name} = "wiki.cgi"; 
     130$config->{_} = { 
     131                 template_path         => cwd . '/t/templates', 
     132                 site_name             => 'CGI::Wiki Test Site', 
     133                 script_url            => 'http://wiki.example.com', 
     134                 script_name           => 'wiki.cgi', 
     135               }; 
    121136$output = OpenGuides::Template->output( 
    122137    wiki     => $fake_wiki,