From 2a93f82b7868e169ca0b689520792157aa376125 Mon Sep 17 00:00:00 2001 From: AndrewJones Date: Mon, 12 Jul 2010 16:23:40 +0000 Subject: [PATCH] Item1959: add a test to ensure that this bug is fixed, and a bonus test git-svn-id: http://svn.foswiki.org/trunk@8143 0b4bb1d4-4e5a-0410-9cc4-b2b747904278 --- .../InterwikiPlugin/InterwikiPluginTests.pm | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/InterwikiPlugin/test/unit/InterwikiPlugin/InterwikiPluginTests.pm b/InterwikiPlugin/test/unit/InterwikiPlugin/InterwikiPluginTests.pm index 7b138eaba2..44eb25139c 100644 --- a/InterwikiPlugin/test/unit/InterwikiPlugin/InterwikiPluginTests.pm +++ b/InterwikiPlugin/test/unit/InterwikiPlugin/InterwikiPluginTests.pm @@ -85,4 +85,34 @@ HERE ); } +sub test_link_with_url { + my $this = shift; + $this->assert_html_equals( + 'Wikipedia:http://www.google.com/search?q=foswiki', + Foswiki::Func::renderText("Wikipedia:http://www.google.com/search?q=foswiki", $this->{test_web}) + ); +} + +sub test_link_with_topic_name { + my $this = shift; + my $localRulesTopic = "LocalInterWikis"; + + Foswiki::Func::saveTopic( $this->{test_web}, $localRulesTopic, undef, + <<'HERE'); +---+++ Local rules + +| *Alias:* | *URL:* | *Tooltip Text:* | +| WebHome | http://rule.invalid.url?page= | Local rule | + +HERE + + Foswiki::Func::setPreferencesValue("INTERWIKIPLUGIN_RULESTOPIC", "$this->{test_web}.$localRulesTopic"); + Foswiki::Plugins::InterwikiPlugin::initPlugin($this->{test_web}, $this->{test_topic}, $this->{test_user}, $Foswiki::cfg{SystemWebName}); + + $this->assert_html_equals( + 'WebHome:Topage', + Foswiki::Func::renderText("WebHome:Topage", $this->{test_web}) + ); +} + 1;