diff options
Diffstat (limited to 'mod/thewire/tests')
| -rw-r--r-- | mod/thewire/tests/regex.php | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/mod/thewire/tests/regex.php b/mod/thewire/tests/regex.php index 5b53c69d6..c73e06bdc 100644 --- a/mod/thewire/tests/regex.php +++ b/mod/thewire/tests/regex.php @@ -38,22 +38,46 @@ class TheWireRegexTest extends ElggCoreUnitTest { parent::__destruct(); } + /** + * Get the link for a user's wire page + * + * @param string $username Username + * @return string + */ protected function getUserWireLink($username) { - $url = "pg/thewire/owner/$username"; + $url = "thewire/owner/$username"; $url = elgg_normalize_url($url); return "<a href=\"$url\">@$username</a>"; } + /** + * Get the link for a hashtag page + * + * @param string $tag Tag string + * @return string + */ protected function getHashtagLink($tag) { - $url = "pg/thewire/tag/$tag"; + $url = "thewire/tag/$tag"; $url = elgg_normalize_url($url); return "<a href=\"$url\">#$tag</a>"; } + /** + * Get a link for an email address mailto + * + * @param string $address Email address + * @return string + */ protected function getEmailLink($address) { return "<a href=\"mailto:$address\">$address</a>"; } + /** + * Get the html for a link + * + * @param string $address URL + * @return string + */ protected function getLink($address) { return parse_urls($address); } @@ -103,6 +127,12 @@ class TheWireRegexTest extends ElggCoreUnitTest { $expected = "test (" . $this->getUserWireLink('user') . ") test"; $result = thewire_filter($text); $this->assertEqual($result, $expected); + + // utf8 characters + $text = "@tyúkanyó"; + $expected = $this->getUserWireLink('tyúkanyó'); + $result = thewire_filter($text); + $this->assertEqual($result, $expected); } /** |
