]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - tests/netscape/BookmarkExportTest.php
New plugin hook: ability to add custom filters to Shaarli search engine
[github/shaarli/Shaarli.git] / tests / netscape / BookmarkExportTest.php
index adf62f4f249248bd943acd2743abf0f50529350d..b8a88cd83c235d2facc0acb57d8a2e3878a31c2b 100644 (file)
@@ -2,11 +2,13 @@
 
 namespace Shaarli\Netscape;
 
+use malkusch\lock\mutex\NoMutex;
 use Shaarli\Bookmark\BookmarkFileService;
 use Shaarli\Config\ConfigManager;
 use Shaarli\Formatter\BookmarkFormatter;
 use Shaarli\Formatter\FormatterFactory;
 use Shaarli\History;
+use Shaarli\Plugin\PluginManager;
 use Shaarli\TestCase;
 
 require_once 'tests/utils/ReferenceLinkDB.php';
@@ -46,6 +48,9 @@ class BookmarkExportTest extends TestCase
      */
     protected static $history;
 
+    /** @var PluginManager */
+    protected static $pluginManager;
+
     /**
      * @var NetscapeBookmarkUtils
      */
@@ -56,12 +61,20 @@ class BookmarkExportTest extends TestCase
      */
     public static function setUpBeforeClass(): void
     {
+        $mutex = new NoMutex();
         static::$conf = new ConfigManager('tests/utils/config/configJson');
         static::$conf->set('resource.datastore', static::$testDatastore);
         static::$refDb = new \ReferenceLinkDB();
         static::$refDb->write(static::$testDatastore);
         static::$history = new History('sandbox/history.php');
-        static::$bookmarkService = new BookmarkFileService(static::$conf, static::$history, true);
+        static::$pluginManager = new PluginManager(static::$conf);
+        static::$bookmarkService = new BookmarkFileService(
+            static::$conf,
+            static::$pluginManager,
+            static::$history,
+            $mutex,
+            true
+        );
         $factory = new FormatterFactory(static::$conf, true);
         static::$formatter = $factory->getFormatter('raw');
     }
@@ -77,10 +90,10 @@ class BookmarkExportTest extends TestCase
 
     /**
      * Attempt to export an invalid link selection
-     * @expectedException              Exception
      */
     public function testFilterAndFormatInvalid()
     {
+        $this->expectException(\Exception::class);
         $this->expectExceptionMessageRegExp('/Invalid export selection/');
 
         $this->netscapeBookmarkUtils->filterAndFormat(