]> 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 3b1a20572a75d428724c8dcf37f50a0f1edb4ff7..b6a273b3338ed30477664f6ea0b5880e782c618a 100644 (file)
@@ -276,7 +276,9 @@ class LinkDBTest extends PHPUnit_Framework_TestCase
                 'media' => 1,
                 'software' => 1,
                 'stallman' => 1,
-                'free' => 1
+                'free' => 1,
+                '-exclude' => 1,
+                'stuff' => 2,
             ),
             self::$publicLinkDB->allTags()
         );
@@ -295,7 +297,10 @@ class LinkDBTest extends PHPUnit_Framework_TestCase
                 'html' => 1,
                 'w3c' => 1,
                 'css' => 1,
-                'Mercurial' => 1
+                'Mercurial' => 1,
+                'stuff' => 2,
+                '-exclude' => 1,
+                '.hidden' => 1,
             ),
             self::$privateLinkDB->allTags()
         );
@@ -347,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))
+        );
+    }
 }