diff options
author | Mark Schmitz <kramred@gmail.com> | 2018-06-07 14:23:53 +0100 |
---|---|---|
committer | Mark Schmitz <kramred@gmail.com> | 2018-06-07 14:23:53 +0100 |
commit | 0deaedeeaef088040fb015f5be3e270e3bae508e (patch) | |
tree | bbdab87adf45592a6a881f808e667ba5c21312a9 /tests/plugins/PluginMarkdownTest.php | |
parent | f6b3295d28352cbeb46dff04799cf8f4d39087bb (diff) | |
parent | 17e45b2e9c33c736751e059276fadb480f98e621 (diff) | |
download | Shaarli-0deaedeeaef088040fb015f5be3e270e3bae508e.tar.gz Shaarli-0deaedeeaef088040fb015f5be3e270e3bae508e.tar.zst Shaarli-0deaedeeaef088040fb015f5be3e270e3bae508e.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'tests/plugins/PluginMarkdownTest.php')
-rw-r--r-- | tests/plugins/PluginMarkdownTest.php | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/plugins/PluginMarkdownTest.php b/tests/plugins/PluginMarkdownTest.php index ddc2728d..b31e817f 100644 --- a/tests/plugins/PluginMarkdownTest.php +++ b/tests/plugins/PluginMarkdownTest.php | |||
@@ -50,6 +50,30 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase | |||
50 | } | 50 | } |
51 | 51 | ||
52 | /** | 52 | /** |
53 | * Test render_feed hook. | ||
54 | */ | ||
55 | public function testMarkdownFeed() | ||
56 | { | ||
57 | $markdown = '# My title' . PHP_EOL . 'Very interesting content.'; | ||
58 | $markdown .= '— <a href="http://domain.tld/?0oc_VQ" title="Permalien">Permalien</a>'; | ||
59 | $data = array( | ||
60 | 'links' => array( | ||
61 | 0 => array( | ||
62 | 'description' => $markdown, | ||
63 | ), | ||
64 | ), | ||
65 | ); | ||
66 | |||
67 | $data = hook_markdown_render_feed($data, $this->conf); | ||
68 | $this->assertNotFalse(strpos($data['links'][0]['description'], '<h1>')); | ||
69 | $this->assertNotFalse(strpos($data['links'][0]['description'], '<p>')); | ||
70 | $this->assertStringEndsWith( | ||
71 | '— <a href="http://domain.tld/?0oc_VQ">Permalien</a></p></div>', | ||
72 | $data['links'][0]['description'] | ||
73 | ); | ||
74 | } | ||
75 | |||
76 | /** | ||
53 | * Test render_daily hook. | 77 | * Test render_daily hook. |
54 | * Only check that there is basic markdown rendering. | 78 | * Only check that there is basic markdown rendering. |
55 | */ | 79 | */ |
@@ -104,6 +128,37 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase | |||
104 | $this->assertEquals($text, $reversedText); | 128 | $this->assertEquals($text, $reversedText); |
105 | } | 129 | } |
106 | 130 | ||
131 | public function testReverseFeedPermalink() | ||
132 | { | ||
133 | $text = 'Description... '; | ||
134 | $text .= '— <a href="http://domain.tld/?0oc_VQ" title="Permalien">Permalien</a>'; | ||
135 | $expected = 'Description... — [Permalien](http://domain.tld/?0oc_VQ)'; | ||
136 | $processedText = reverse_feed_permalink($text); | ||
137 | |||
138 | $this->assertEquals($expected, $processedText); | ||
139 | } | ||
140 | |||
141 | public function testReverseLastFeedPermalink() | ||
142 | { | ||
143 | $text = 'Description... '; | ||
144 | $text .= '<br>— <a href="http://domain.tld/?0oc_VQ" title="Permalien">Permalien</a>'; | ||
145 | $expected = $text; | ||
146 | $text .= '<br>— <a href="http://domain.tld/?0oc_VQ" title="Permalien">Permalien</a>'; | ||
147 | $expected .= '<br>— [Permalien](http://domain.tld/?0oc_VQ)'; | ||
148 | $processedText = reverse_feed_permalink($text); | ||
149 | |||
150 | $this->assertEquals($expected, $processedText); | ||
151 | } | ||
152 | |||
153 | public function testReverseNoFeedPermalink() | ||
154 | { | ||
155 | $text = 'Hello! Where are you from?'; | ||
156 | $expected = $text; | ||
157 | $processedText = reverse_feed_permalink($text); | ||
158 | |||
159 | $this->assertEquals($expected, $processedText); | ||
160 | } | ||
161 | |||
107 | /** | 162 | /** |
108 | * Test sanitize_html(). | 163 | * Test sanitize_html(). |
109 | */ | 164 | */ |