]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - tests/LinkFilterTest.php
Ignore the case while checking DOCTYPE during the file import
[github/shaarli/Shaarli.git] / tests / LinkFilterTest.php
index 741623580ce30e0980638675db8f17b9e02d2e70..9cd6dbd443b2a52b492cd165d12155c06aa14f49 100644 (file)
@@ -7,6 +7,10 @@ require_once 'application/LinkFilter.php';
  */
 class LinkFilterTest extends PHPUnit_Framework_TestCase
 {
+    /**
+     * @var string Test datastore path.
+     */
+    protected static $testDatastore = 'sandbox/datastore.php';
     /**
      * @var LinkFilter instance.
      */
@@ -17,13 +21,20 @@ class LinkFilterTest extends PHPUnit_Framework_TestCase
      */
     protected static $refDB;
 
+    /**
+     * @var LinkDB instance
+     */
+    protected static $linkDB;
+
     /**
      * Instanciate linkFilter with ReferenceLinkDB data.
      */
     public static function setUpBeforeClass()
     {
         self::$refDB = new ReferenceLinkDB();
-        self::$linkFilter = new LinkFilter(self::$refDB->getLinks());
+        self::$refDB->write(self::$testDatastore);
+        self::$linkDB = new LinkDB(self::$testDatastore, true, false);
+        self::$linkFilter = new LinkFilter(self::$linkDB);
     }
 
     /**
@@ -63,10 +74,9 @@ class LinkFilterTest extends PHPUnit_Framework_TestCase
             count(self::$linkFilter->filter(LinkFilter::$FILTER_TAG, ''))
         );
 
-        // Untagged only
         $this->assertEquals(
             self::$refDB->countUntaggedLinks(),
-            count(self::$linkFilter->filter(LinkFilter::$FILTER_TAG, false))
+            count(self::$linkFilter->filter(LinkFilter::$FILTER_TAG, /*$request=*/'', /*$casesensitive=*/false, /*$visibility=*/'all', /*$untaggedonly=*/true))
         );
 
         $this->assertEquals(