X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2FLinkUtilsTest.php;h=99679320ae3ea696762abea4d127ac6b8e5dde84;hb=8e9fc6f6e6afc052a2c3b2d459764cc9ab20420a;hp=7c0d4b0bdc9bf7e0c029231bab2d07e16db26082;hpb=9ccca40189652e529732683abcdf54fcf775c9ec;p=github%2Fshaarli%2FShaarli.git diff --git a/tests/LinkUtilsTest.php b/tests/LinkUtilsTest.php index 7c0d4b0b..99679320 100644 --- a/tests/LinkUtilsTest.php +++ b/tests/LinkUtilsTest.php @@ -103,6 +103,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); } /** @@ -120,6 +130,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. */