Ignore:
Timestamp:
Jun 9, 2007, 2:36:35 PM (14 years ago)
Author:
kake
Message:

Eradicate Test::MockObject? from test 18

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/t/18_http_headers.t

    r868 r1041  
    11use strict;
    22use Cwd;
    3 use CGI::Cookie;
    4 use Wiki::Toolkit::Formatter::UseMod;
    5 use OpenGuides::Config;
     3use OpenGuides;
    64use OpenGuides::Template;
    7 use Test::MockObject;
     5use OpenGuides::Test;
    86use Test::More tests => 5;
    97
    10 my $config = OpenGuides::Config->new(
    11        vars => {
    12                  template_path         => cwd . '/t/templates',
    13                  site_name             => 'Wiki::Toolkit 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                  formatting_rules_link => '',
    23                }
    24 );
     8my $config = OpenGuides::Test->make_basic_config;
     9$config->template_path( cwd . "/t/templates" );
    2510
    26 # White box testing - we know that OpenGuides::Template only actually uses
    27 # the node_name_to_node_param method of the formatter component of the wiki
    28 # object passed in, and I CBA to make a proper wiki object here.
    29 my $fake_wiki = Test::MockObject->new;
    30 $fake_wiki->mock("formatter",
    31                  sub { return Wiki::Toolkit::Formatter::UseMod->new( munge_urls => 1 ); } );
     11my $guide = OpenGuides->new( config => $config );
     12my $wiki = $guide->wiki;
    3213
    3314eval {
    34     OpenGuides::Template->output( wiki     => $fake_wiki,
     15    OpenGuides::Template->output( wiki     => $wiki,
    3516                                  config   => $config,
    3617                                  template => "15_test.tt" );
     
    3920
    4021my $output = OpenGuides::Template->output(
    41     wiki     => $fake_wiki,
     22    wiki     => $wiki,
    4223    config   => $config,
    4324    template => "15_test.tt"
     
    4728
    4829# Now supply a http charset
    49 $config->{http_charset} = "UTF-8";
     30$config->http_charset( "UTF-8" );
    5031
    5132$output = OpenGuides::Template->output(
    52     wiki     => $fake_wiki,
     33    wiki     => $wiki,
    5334    config   => $config,
    5435    template => "15_test.tt"
     
    5940# Suppy charset and content type
    6041$output = OpenGuides::Template->output(
    61     wiki     => $fake_wiki,
     42    wiki     => $wiki,
    6243    config   => $config,
    6344    content_type => "text/xml",
     
    6849
    6950# Content type but no charset
    70 $config->{http_charset} = "";
     51$config->http_charset( "" );
    7152$output = OpenGuides::Template->output(
    72     wiki     => $fake_wiki,
     53    wiki     => $wiki,
    7354    config   => $config,
    7455    content_type => "text/xml",
Note: See TracChangeset for help on using the changeset viewer.