source: trunk/t/41_deletion.t @ 311

Last change on this file since 311 was 311, checked in by kake, 18 years ago

Tweaks to stop tests warning on 5.8.2

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.5 KB
Line 
1use strict;
2use Test::More tests => 3;
3use Config::Tiny;
4use Cwd;
5use CGI::Wiki::Formatter::UseMod;
6use OpenGuides::Template;
7use Test::MockObject;
8
9my $config = Config::Tiny->new;
10$config->{_}->{template_path} = cwd . "/templates";
11$config->{_}->{site_name} = "Test Site";
12$config->{_}->{script_url} = "/";
13$config->{_}->{script_name} = "";
14
15# White box testing - we know that OpenGuides::Template only actually uses
16# the node_name_to_node_param method of the formatter component of the wiki
17# object passed in, and I CBA to faff about with picking out the test DB
18# info to make a proper wiki object here.
19my $fake_wiki = Test::MockObject->new;
20$fake_wiki->mock("formatter",
21                 sub { return CGI::Wiki::Formatter::UseMod->new( munge_urls => 1 ); } );
22
23my $output = OpenGuides::Template->output(
24    wiki     => $fake_wiki,
25    config   => $config,
26    template => "node.tt",
27);
28unlike( $output, qr/action=delete/,
29        "doesn't offer page deletion link by default" );
30$config->{_}->{enable_page_deletion} = "y";
31$output = OpenGuides::Template->output(
32    wiki     => $fake_wiki,
33    config   => $config,
34    template => "node.tt",
35);
36like( $output, qr/action=delete/,
37      "...but does when enable_page_deletion is set to 'y'" );
38$config->{_}->{enable_page_deletion} = "1";
39$output = OpenGuides::Template->output(
40    wiki     => $fake_wiki,
41    config   => $config,
42    template => "node.tt",
43);
44like( $output, qr/action=delete/,
45      "...and when enable_page_deletion is set to '1'" );
Note: See TracBrowser for help on using the repository browser.