X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2FLinkUtilsTest.php;h=ca062f053aa4224f3f83d4b279a4f3b1d35199ee;hb=067c2dd8f5f6eb6cc808ddc4bd30aec104caf73d;hp=ef650f448d382fd2e4ab7ab7959186f831c255c9;hpb=d65342e304f92643ba922200953cfebc51e1e482;p=github%2Fshaarli%2FShaarli.git diff --git a/tests/LinkUtilsTest.php b/tests/LinkUtilsTest.php index ef650f44..ca062f05 100644 --- a/tests/LinkUtilsTest.php +++ b/tests/LinkUtilsTest.php @@ -214,6 +214,16 @@ class LinkUtilsTest extends PHPUnit_Framework_TestCase $expectedText = 'stuff http://hello.there/is=someone#here otherstuff'; $processedText = text2clickable($text, ''); $this->assertEquals($expectedText, $processedText); + + $text = 'stuff http://hello.there/is=someone#here(please) otherstuff'; + $expectedText = 'stuff http://hello.there/is=someone#here(please) otherstuff'; + $processedText = text2clickable($text, ''); + $this->assertEquals($expectedText, $processedText); + + $text = 'stuff http://hello.there/is=someone#here(please)&no otherstuff'; + $expectedText = 'stuff http://hello.there/is=someone#here(please)&no otherstuff'; + $processedText = text2clickable($text, ''); + $this->assertEquals($expectedText, $processedText); } /** @@ -231,6 +241,21 @@ class LinkUtilsTest extends PHPUnit_Framework_TestCase $this->assertEquals($expectedText, $processedText); } + /** + * Test text2clickable a redirector set and without URL encode. + */ + public function testText2clickableWithRedirectorDontEncode() + { + $text = 'stuff http://hello.there/?is=someone&or=something#here otherstuff'; + $redirector = 'http://redirector.to'; + $expectedText = 'stuff http://hello.there/?is=someone&or=something#here otherstuff'; + $processedText = text2clickable($text, $redirector, false); + $this->assertEquals($expectedText, $processedText); + } + /** * Test testSpace2nbsp. */ @@ -385,4 +410,3 @@ function ut_curl_getinfo_rs_ct_ko($ch, $type) return 'text/plain'; } } -