aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/plugins/PluginMarkdownTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/plugins/PluginMarkdownTest.php')
-rw-r--r--tests/plugins/PluginMarkdownTest.php22
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/plugins/PluginMarkdownTest.php b/tests/plugins/PluginMarkdownTest.php
index b31e817f..5e7c02b0 100644
--- a/tests/plugins/PluginMarkdownTest.php
+++ b/tests/plugins/PluginMarkdownTest.php
@@ -1,10 +1,14 @@
1<?php 1<?php
2namespace Shaarli\Plugin\Markdown;
3
2use Shaarli\Config\ConfigManager; 4use Shaarli\Config\ConfigManager;
5use Shaarli\Plugin\PluginManager;
3 6
4/** 7/**
5 * PluginMarkdownTest.php 8 * PluginMarkdownTest.php
6 */ 9 */
7 10
11require_once 'application/bookmark/LinkUtils.php';
8require_once 'application/Utils.php'; 12require_once 'application/Utils.php';
9require_once 'plugins/markdown/markdown.php'; 13require_once 'plugins/markdown/markdown.php';
10 14
@@ -12,7 +16,7 @@ require_once 'plugins/markdown/markdown.php';
12 * Class PluginMarkdownTest 16 * Class PluginMarkdownTest
13 * Unit test for the Markdown plugin 17 * Unit test for the Markdown plugin
14 */ 18 */
15class PluginMarkdownTest extends PHPUnit_Framework_TestCase 19class PluginMarkdownTest extends \PHPUnit\Framework\TestCase
16{ 20{
17 /** 21 /**
18 * @var ConfigManager instance. 22 * @var ConfigManager instance.
@@ -47,6 +51,8 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase
47 $data = hook_markdown_render_linklist($data, $this->conf); 51 $data = hook_markdown_render_linklist($data, $this->conf);
48 $this->assertNotFalse(strpos($data['links'][0]['description'], '<h1>')); 52 $this->assertNotFalse(strpos($data['links'][0]['description'], '<h1>'));
49 $this->assertNotFalse(strpos($data['links'][0]['description'], '<p>')); 53 $this->assertNotFalse(strpos($data['links'][0]['description'], '<p>'));
54
55 $this->assertEquals($markdown, $data['links'][0]['description_src']);
50 } 56 }
51 57
52 /** 58 /**
@@ -107,6 +113,18 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase
107 } 113 }
108 114
109 /** 115 /**
116 * Test reverse_text2clickable().
117 */
118 public function testReverseText2clickableHashtags()
119 {
120 $text = file_get_contents('tests/plugins/resources/hashtags.raw');
121 $md = file_get_contents('tests/plugins/resources/hashtags.md');
122 $clickableText = hashtag_autolink($text);
123 $reversedText = reverse_text2clickable($clickableText);
124 $this->assertEquals($md, $reversedText);
125 }
126
127 /**
110 * Test reverse_nl2br(). 128 * Test reverse_nl2br().
111 */ 129 */
112 public function testReverseNl2br() 130 public function testReverseNl2br()
@@ -246,7 +264,7 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase
246 $this->conf->get('security.markdown_escape', true), 264 $this->conf->get('security.markdown_escape', true),
247 $this->conf->get('security.allowed_protocols') 265 $this->conf->get('security.allowed_protocols')
248 ); 266 );
249 $this->assertEquals($html, $data); 267 $this->assertEquals($html, $data . PHP_EOL);
250 } 268 }
251 269
252 /** 270 /**