aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-11-05 16:47:17 +0100
committerGitHub <noreply@github.com>2020-11-05 16:47:17 +0100
commit8bbf57a2d0dfe8d8d6416a26f9ff1177c77e806b (patch)
tree8b2ff8ff1eabb2370ccf5931409f697e7d6f004f /tests
parent47d15818502b11315b484131aaf67a3e3f441c5a (diff)
parent740b32b520e6b1723512c6f9b78cef6575b1725b (diff)
downloadShaarli-8bbf57a2d0dfe8d8d6416a26f9ff1177c77e806b.tar.gz
Shaarli-8bbf57a2d0dfe8d8d6416a26f9ff1177c77e806b.tar.zst
Shaarli-8bbf57a2d0dfe8d8d6416a26f9ff1177c77e806b.zip
Merge pull request #1620 from ArthurHoaro/feature/no-auto-link
Default formatter: add a setting to disable auto-linkification
Diffstat (limited to 'tests')
-rw-r--r--tests/formatter/BookmarkDefaultFormatterTest.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/formatter/BookmarkDefaultFormatterTest.php b/tests/formatter/BookmarkDefaultFormatterTest.php
index 3fc6f8dc..4fcc5dd1 100644
--- a/tests/formatter/BookmarkDefaultFormatterTest.php
+++ b/tests/formatter/BookmarkDefaultFormatterTest.php
@@ -289,4 +289,24 @@ class BookmarkDefaultFormatterTest extends TestCase
289 $link['taglist_html'] 289 $link['taglist_html']
290 ); 290 );
291 } 291 }
292
293 /**
294 * Test default formatting with formatter_settings.autolink set to false:
295 * URLs and hashtags should not be transformed
296 */
297 public function testFormatDescriptionWithoutLinkification(): void
298 {
299 $this->conf->set('formatter_settings.autolink', false);
300 $this->formatter = new BookmarkDefaultFormatter($this->conf, false);
301
302 $bookmark = new Bookmark();
303 $bookmark->setDescription('Hi!' . PHP_EOL . 'https://thisisaurl.tld #hashtag');
304
305 $link = $this->formatter->format($bookmark);
306
307 static::assertSame(
308 'Hi!<br />' . PHP_EOL . 'https://thisisaurl.tld &nbsp;#hashtag',
309 $link['description']
310 );
311 }
292} 312}