diff options
author | ArthurHoaro <arthur@hoa.ro> | 2016-12-18 12:40:27 +0100 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2016-12-18 12:40:27 +0100 |
commit | 8147ff76a49206a08999f420206d971de10db12e (patch) | |
tree | dea3412c8e30cfab464557bcbe4c5c3fb08bc33e /tests/plugins/PluginMarkdownTest.php | |
parent | 9eba6ff469bdea8f341af06ef23c8bb4bd3a6869 (diff) | |
parent | e3ffc8fdee30be41046b985fe6e7034fb580b0c8 (diff) | |
download | Shaarli-8147ff76a49206a08999f420206d971de10db12e.tar.gz Shaarli-8147ff76a49206a08999f420206d971de10db12e.tar.zst Shaarli-8147ff76a49206a08999f420206d971de10db12e.zip |
merge
Diffstat (limited to 'tests/plugins/PluginMarkdownTest.php')
-rw-r--r-- | tests/plugins/PluginMarkdownTest.php | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/tests/plugins/PluginMarkdownTest.php b/tests/plugins/PluginMarkdownTest.php index 12bdda24..4a67b2dc 100644 --- a/tests/plugins/PluginMarkdownTest.php +++ b/tests/plugins/PluginMarkdownTest.php | |||
@@ -8,8 +8,8 @@ require_once 'application/Utils.php'; | |||
8 | require_once 'plugins/markdown/markdown.php'; | 8 | require_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 | */ |
14 | class PluginMarkdownTest extends PHPUnit_Framework_TestCase | 14 | class 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,37 @@ 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 | /** | ||
177 | * Test hashtag links processed with markdown. | ||
178 | */ | ||
179 | function testMarkdownHashtagLinks() | ||
180 | { | ||
181 | $md = file_get_contents('tests/plugins/resources/markdown.md'); | ||
182 | $md = format_description($md); | ||
183 | $html = file_get_contents('tests/plugins/resources/markdown.html'); | ||
184 | |||
185 | $data = process_markdown($md); | ||
186 | $this->assertEquals($html, $data); | ||
187 | } | ||
188 | |||
189 | /** | ||
156 | * Test hashtag links processed with markdown. | 190 | * Test hashtag links processed with markdown. |
157 | */ | 191 | */ |
158 | function testMarkdownHashtagLinks() | 192 | function testMarkdownHashtagLinks() |