Skip to content

Commit

Permalink
Item1959: add a test to ensure that this bug is fixed, and a bonus test
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk@8143 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
AndrewJones authored and AndrewJones committed Jul 12, 2010
1 parent f831779 commit 2a93f82
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions InterwikiPlugin/test/unit/InterwikiPlugin/InterwikiPluginTests.pm
Expand Up @@ -85,4 +85,34 @@ HERE
);
}

sub test_link_with_url {
my $this = shift;
$this->assert_html_equals(
'<a class="interwikiLink" href="http://en.wikipedia.org/wiki/http://www.google.com/search?q=foswiki" title="\'http://www.google.com/search?q=foswiki\' on \'Wikipedia\'"><noautolink>Wikipedia:http://www.google.com/search?q=foswiki</noautolink></a>',
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
<noautolink>
| *Alias:* | *URL:* | *Tooltip Text:* |
| WebHome | http://rule.invalid.url?page= | Local rule |
</nautolink>
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(
'<a class="interwikiLink" href="http://rule.invalid.url?page=Topage" title="Local rule"><noautolink>WebHome:Topage</noautolink></a>',
Foswiki::Func::renderText("WebHome:Topage", $this->{test_web})
);
}

1;

0 comments on commit 2a93f82

Please sign in to comment.