From a8e7da01146455f13ef06b151a7dafedd3acf769 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Sat, 9 Feb 2019 14:13:08 +0100 Subject: Do not try to retrieve thumbnails for internal link Also adds a helper function to determine if a link is a note and apply it across multiple files. --- tests/bookmark/LinkUtilsTest.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests/bookmark') diff --git a/tests/bookmark/LinkUtilsTest.php b/tests/bookmark/LinkUtilsTest.php index 1b8688e6..5b31115b 100644 --- a/tests/bookmark/LinkUtilsTest.php +++ b/tests/bookmark/LinkUtilsTest.php @@ -317,6 +317,26 @@ class LinkUtilsTest extends \PHPUnit\Framework\TestCase $this->assertNotContains('>#nothashtag', $autolinkedDescription); } + /** + * Test is_note with note URLs. + */ + public function testIsNote() + { + $this->assertTrue(is_note('?')); + $this->assertTrue(is_note('?abcDEf')); + $this->assertTrue(is_note('?_abcDEf#123')); + } + + /** + * Test is_note with non note URLs. + */ + public function testIsNotNote() + { + $this->assertFalse(is_note('')); + $this->assertFalse(is_note('nope')); + $this->assertFalse(is_note('https://github.com/shaarli/Shaarli/?hi')); + } + /** * Util function to build an hashtag link. * -- cgit v1.2.3