From 195acf9f0931aa3b1a6db8832ab52a260d11090d Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Thu, 21 Jan 2016 20:18:44 +0100 Subject: Private/Hidden tags Tags starting with a dot '.' are now private. They can only be seen and searched when logged in. Fixes #315 --- tests/LinkDBTest.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tests/LinkDBTest.php') diff --git a/tests/LinkDBTest.php b/tests/LinkDBTest.php index 06edea79..765f771e 100644 --- a/tests/LinkDBTest.php +++ b/tests/LinkDBTest.php @@ -298,6 +298,7 @@ class LinkDBTest extends PHPUnit_Framework_TestCase 'css' => 1, 'Mercurial' => 1, '-exclude' => 1, + '.hidden' => 1, ), self::$privateLinkDB->allTags() ); @@ -349,4 +350,22 @@ class LinkDBTest extends PHPUnit_Framework_TestCase count(self::$privateLinkDB->filter(LinkFilter::$FILTER_TAG, $tags, true, false)) ); } + + /** + * Test hidden tags feature: + * tags starting with a dot '.' are only visible when logged in. + */ + public function testHiddenTags() + { + $tags = '.hidden'; + $this->assertEquals( + 1, + count(self::$privateLinkDB->filter(LinkFilter::$FILTER_TAG, $tags, true, false)) + ); + + $this->assertEquals( + 0, + count(self::$publicLinkDB->filter(LinkFilter::$FILTER_TAG, $tags, true, false)) + ); + } } -- cgit v1.2.3