X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2Fplugins%2FPluginMarkdownTest.php;h=d695186620cfc8f0a7188e8ccad69cb467565e90;hb=fe3713d2e5c91e2d07af72b39f321521d3dd470c;hp=b31e817fe6093c85e7a5dbb57813a1d6f2ec0ad0;hpb=8f816d8ddfe9219e15580cef6e5c9037d1d4fd28;p=github%2Fshaarli%2FShaarli.git diff --git a/tests/plugins/PluginMarkdownTest.php b/tests/plugins/PluginMarkdownTest.php index b31e817f..d6951866 100644 --- a/tests/plugins/PluginMarkdownTest.php +++ b/tests/plugins/PluginMarkdownTest.php @@ -5,6 +5,7 @@ use Shaarli\Config\ConfigManager; * PluginMarkdownTest.php */ +require_once 'application/bookmark/LinkUtils.php'; require_once 'application/Utils.php'; require_once 'plugins/markdown/markdown.php'; @@ -47,6 +48,8 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase $data = hook_markdown_render_linklist($data, $this->conf); $this->assertNotFalse(strpos($data['links'][0]['description'], '

')); $this->assertNotFalse(strpos($data['links'][0]['description'], '

')); + + $this->assertEquals($markdown, $data['links'][0]['description_src']); } /** @@ -106,6 +109,18 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase $this->assertEquals($text, $reversedText); } + /** + * Test reverse_text2clickable(). + */ + public function testReverseText2clickableHashtags() + { + $text = file_get_contents('tests/plugins/resources/hashtags.raw'); + $md = file_get_contents('tests/plugins/resources/hashtags.md'); + $clickableText = hashtag_autolink($text); + $reversedText = reverse_text2clickable($clickableText); + $this->assertEquals($md, $reversedText); + } + /** * Test reverse_nl2br(). */ @@ -246,7 +261,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase $this->conf->get('security.markdown_escape', true), $this->conf->get('security.allowed_protocols') ); - $this->assertEquals($html, $data); + $this->assertEquals($html, $data . PHP_EOL); } /**