aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2016-11-13 16:51:21 +0100
committerArthurHoaro <arthur@hoa.ro>2016-11-22 10:26:03 +0100
commit266e3fe5c8961aaf089bad16b9e4c54de1aaff40 (patch)
treede524c1b2478670cf3a7c5563ef076f4ef0c72de /tests
parentf5f6a4b7e21f39c916fda11eebb1c8df17e1ad4a (diff)
downloadShaarli-266e3fe5c8961aaf089bad16b9e4c54de1aaff40.tar.gz
Shaarli-266e3fe5c8961aaf089bad16b9e4c54de1aaff40.tar.zst
Shaarli-266e3fe5c8961aaf089bad16b9e4c54de1aaff40.zip
Markdown: fixes feed rendering with nomarkdown tag
* make sure we match exactly `nomarkdown` tag * pass the whole link data to stripNoMarkdownTag() to: * strip the noMD tag in taglist (array) * strip the tag in tags (string) Fixes #689 tmp
Diffstat (limited to 'tests')
-rw-r--r--tests/plugins/PluginMarkdownTest.php29
1 files changed, 25 insertions, 4 deletions
diff --git a/tests/plugins/PluginMarkdownTest.php b/tests/plugins/PluginMarkdownTest.php
index 12bdda24..17ef2280 100644
--- a/tests/plugins/PluginMarkdownTest.php
+++ b/tests/plugins/PluginMarkdownTest.php
@@ -8,8 +8,8 @@ require_once 'application/Utils.php';
8require_once 'plugins/markdown/markdown.php'; 8require_once 'plugins/markdown/markdown.php';
9 9
10/** 10/**
11 * Class PlugQrcodeTest 11 * Class PluginMarkdownTest
12 * Unit test for the QR-Code plugin 12 * Unit test for the Markdown plugin
13 */ 13 */
14class PluginMarkdownTest extends PHPUnit_Framework_TestCase 14class PluginMarkdownTest extends PHPUnit_Framework_TestCase
15{ 15{
@@ -130,8 +130,11 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase
130 )) 130 ))
131 ); 131 );
132 132
133 $data = hook_markdown_render_linklist($data); 133 $processed = hook_markdown_render_linklist($data);
134 $this->assertEquals($str, $data['links'][0]['description']); 134 $this->assertEquals($str, $processed['links'][0]['description']);
135
136 $processed = hook_markdown_render_feed($data);
137 $this->assertEquals($str, $processed['links'][0]['description']);
135 138
136 $data = array( 139 $data = array(
137 // Columns data 140 // Columns data
@@ -153,6 +156,24 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase
153 } 156 }
154 157
155 /** 158 /**
159 * Test that a close value to nomarkdown is not understand as nomarkdown (previous value `.nomarkdown`).
160 */
161 function testNoMarkdownNotExcactlyMatching()
162 {
163 $str = 'All _work_ and `no play` makes Jack a *dull* boy.';
164 $data = array(
165 'links' => array(array(
166 'description' => $str,
167 'tags' => '.' . NO_MD_TAG,
168 'taglist' => array('.'. NO_MD_TAG),
169 ))
170 );
171
172 $data = hook_markdown_render_feed($data);
173 $this->assertContains('<em>', $data['links'][0]['description']);
174 }
175
176 /**
156 * Test hashtag links processed with markdown. 177 * Test hashtag links processed with markdown.
157 */ 178 */
158 function testMarkdownHashtagLinks() 179 function testMarkdownHashtagLinks()