From e480ca00ba507ea1575bad7ffb824d8d72b666d4 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Thu, 10 Oct 2013 23:02:36 +0200 Subject: Replace markdown-style [1] link indexes in plain text email bodies. [1]: http://daringfireball.net/projects/markdown/ --- tests/Framework/StringReplacer.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/Framework/StringReplacer.php') diff --git a/tests/Framework/StringReplacer.php b/tests/Framework/StringReplacer.php index e23fb9b17..0fa7fae34 100644 --- a/tests/Framework/StringReplacer.php +++ b/tests/Framework/StringReplacer.php @@ -56,4 +56,20 @@ class Framework_StringReplacer extends PHPUnit_Framework_TestCase $this->assertEquals($output, $result); } + + function test_linkrefs() + { + $input = "This is a sample message [1] to test the new linkref [ref0] replacement feature of [Roundcube].\n"; + $input.= "\n"; + $input.= "[1] http://en.wikipedia.org/wiki/Email\n"; + $input.= "[ref0] www.link-ref.com\n"; + + $replacer = new rcube_string_replacer; + $result = $replacer->replace($input); + $result = $replacer->resolve($result); + + $this->assertContains('[1] to', $result, "Numeric linkref replacements"); + $this->assertContains('[ref0] repl', $result, "Alphanum linkref replacements"); + $this->assertContains('of [Roundcube].', $result, "Don't touch strings wihtout an index entry"); + } } -- cgit v1.2.3