]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - tests/LinkUtilsTest.php
Don't URL encode description links if parameter 'redirector.encode_url' is set to...
[github/shaarli/Shaarli.git] / tests / LinkUtilsTest.php
index c77922ecea0c2a13dcbd8ff59e961925775956cb..99679320ae3ea696762abea4d127ac6b8e5dde84 100644 (file)
@@ -130,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 <a href="'.
+            $redirector .
+            'http://hello.there/?is=someone&or=something#here' .
+            '">http://hello.there/?is=someone&or=something#here</a> otherstuff';
+        $processedText = text2clickable($text, $redirector, false);
+        $this->assertEquals($expectedText, $processedText);
+    }
+
     /**
      * Test testSpace2nbsp.
      */