]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - tests/LinkDBTest.php
Support text search across link fields.
[github/shaarli/Shaarli.git] / tests / LinkDBTest.php
index 06edea79201a2fe18ea53cf9a7277b95153b055e..b6a273b3338ed30477664f6ea0b5880e782c618a 100644 (file)
@@ -278,6 +278,7 @@ class LinkDBTest extends PHPUnit_Framework_TestCase
                 'stallman' => 1,
                 'free' => 1,
                 '-exclude' => 1,
+                'stuff' => 2,
             ),
             self::$publicLinkDB->allTags()
         );
@@ -297,7 +298,9 @@ class LinkDBTest extends PHPUnit_Framework_TestCase
                 'w3c' => 1,
                 'css' => 1,
                 'Mercurial' => 1,
+                'stuff' => 2,
                 '-exclude' => 1,
+                '.hidden' => 1,
             ),
             self::$privateLinkDB->allTags()
         );
@@ -349,4 +352,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))
+        );
+    }
 }