diff options
Diffstat (limited to 'tests/bookmark/BookmarkFileServiceTest.php')
-rw-r--r-- | tests/bookmark/BookmarkFileServiceTest.php | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/bookmark/BookmarkFileServiceTest.php b/tests/bookmark/BookmarkFileServiceTest.php index 1b438a7f..4900d41d 100644 --- a/tests/bookmark/BookmarkFileServiceTest.php +++ b/tests/bookmark/BookmarkFileServiceTest.php | |||
@@ -12,6 +12,7 @@ use ReflectionClass; | |||
12 | use Shaarli; | 12 | use Shaarli; |
13 | use Shaarli\Bookmark\Exception\BookmarkNotFoundException; | 13 | use Shaarli\Bookmark\Exception\BookmarkNotFoundException; |
14 | use Shaarli\Config\ConfigManager; | 14 | use Shaarli\Config\ConfigManager; |
15 | use Shaarli\Formatter\BookmarkMarkdownFormatter; | ||
15 | use Shaarli\History; | 16 | use Shaarli\History; |
16 | 17 | ||
17 | /** | 18 | /** |
@@ -1026,6 +1027,46 @@ class BookmarkFileServiceTest extends TestCase | |||
1026 | } | 1027 | } |
1027 | 1028 | ||
1028 | /** | 1029 | /** |
1030 | * Test linksCountPerTag public tags with filter. | ||
1031 | * Equal occurrences should be sorted alphabetically. | ||
1032 | */ | ||
1033 | public function testCountTagsNoMarkdown() | ||
1034 | { | ||
1035 | $expected = [ | ||
1036 | 'cartoon' => 3, | ||
1037 | 'dev' => 2, | ||
1038 | 'tag1' => 1, | ||
1039 | 'tag2' => 1, | ||
1040 | 'tag3' => 1, | ||
1041 | 'tag4' => 1, | ||
1042 | 'web' => 4, | ||
1043 | 'gnu' => 2, | ||
1044 | 'hashtag' => 2, | ||
1045 | 'sTuff' => 2, | ||
1046 | '-exclude' => 1, | ||
1047 | '.hidden' => 1, | ||
1048 | 'Mercurial' => 1, | ||
1049 | 'css' => 1, | ||
1050 | 'free' => 1, | ||
1051 | 'html' => 1, | ||
1052 | 'media' => 1, | ||
1053 | 'newTagToCount' => 1, | ||
1054 | 'samba' => 1, | ||
1055 | 'software' => 1, | ||
1056 | 'stallman' => 1, | ||
1057 | 'ut' => 1, | ||
1058 | 'w3c' => 1, | ||
1059 | ]; | ||
1060 | $bookmark = new Bookmark(); | ||
1061 | $bookmark->setTags(['newTagToCount', BookmarkMarkdownFormatter::NO_MD_TAG]); | ||
1062 | $this->privateLinkDB->add($bookmark); | ||
1063 | |||
1064 | $tags = $this->privateLinkDB->bookmarksCountPerTag(); | ||
1065 | |||
1066 | $this->assertEquals($expected, $tags, var_export($tags, true)); | ||
1067 | } | ||
1068 | |||
1069 | /** | ||
1029 | * Allows to test LinkDB's private methods | 1070 | * Allows to test LinkDB's private methods |
1030 | * | 1071 | * |
1031 | * @see | 1072 | * @see |