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

Last change on this file since 785 was 785, checked in by Dominic Hargreaves, 15 years ago

Use Wiki::Toolkit. Note that CGI::Wiki::Plugin::Diff hasn't been converted yet,
so tests will be broken for now.

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