aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/formatter/BookmarkDefaultFormatterTest.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-01-18 17:59:37 +0100
committerGitHub <noreply@github.com>2020-01-18 17:59:37 +0100
commit1001cc108fec759b076c9f6e12b71dea5d49fe9b (patch)
treed7b57a982129b2006d388c2f9d25d29eceee891a /tests/formatter/BookmarkDefaultFormatterTest.php
parent12523aea3458504be91854ce2f37d4f5991ccea2 (diff)
parenta39acb2518f272df8a601af72c13eabe2719dcb8 (diff)
downloadShaarli-1001cc108fec759b076c9f6e12b71dea5d49fe9b.tar.gz
Shaarli-1001cc108fec759b076c9f6e12b71dea5d49fe9b.tar.zst
Shaarli-1001cc108fec759b076c9f6e12b71dea5d49fe9b.zip
Fix an issue with private tags and fix nomarkdown tag (#1399)
Fix an issue with private tags and fix nomarkdown tag
Diffstat (limited to 'tests/formatter/BookmarkDefaultFormatterTest.php')
-rw-r--r--tests/formatter/BookmarkDefaultFormatterTest.php23
1 files changed, 22 insertions, 1 deletions
diff --git a/tests/formatter/BookmarkDefaultFormatterTest.php b/tests/formatter/BookmarkDefaultFormatterTest.php
index fe42a208..382a560e 100644
--- a/tests/formatter/BookmarkDefaultFormatterTest.php
+++ b/tests/formatter/BookmarkDefaultFormatterTest.php
@@ -29,7 +29,7 @@ class BookmarkDefaultFormatterTest extends TestCase
29 { 29 {
30 copy('tests/utils/config/configJson.json.php', self::$testConf .'.json.php'); 30 copy('tests/utils/config/configJson.json.php', self::$testConf .'.json.php');
31 $this->conf = new ConfigManager(self::$testConf); 31 $this->conf = new ConfigManager(self::$testConf);
32 $this->formatter = new BookmarkDefaultFormatter($this->conf); 32 $this->formatter = new BookmarkDefaultFormatter($this->conf, true);
33 } 33 }
34 34
35 /** 35 /**
@@ -153,4 +153,25 @@ class BookmarkDefaultFormatterTest extends TestCase
153 $link['description'] 153 $link['description']
154 ); 154 );
155 } 155 }
156
157 /**
158 * Make sure that private tags are properly filtered out when the user is logged out.
159 */
160 public function testFormatTagListRemovePrivate(): void
161 {
162 $this->formatter = new BookmarkDefaultFormatter($this->conf, false);
163
164 $bookmark = new Bookmark();
165 $bookmark->setId($id = 11);
166 $bookmark->setTags($tags = ['bookmark', '.private', 'othertag']);
167
168 $link = $this->formatter->format($bookmark);
169
170 unset($tags[1]);
171 $tags = array_values($tags);
172
173 $this->assertSame(11, $link['id']);
174 $this->assertSame($tags, $link['taglist']);
175 $this->assertSame(implode(' ', $tags), $link['tags']);
176 }
156} 177}