]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - tests/LinkDBTest.php
Private/Hidden tags
[github/shaarli/Shaarli.git] / tests / LinkDBTest.php
index 06edea79201a2fe18ea53cf9a7277b95153b055e..765f771ec5381c1cbf8f3fe21843fc892488e566 100644 (file)
@@ -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))
+        );
+    }
 }