From bcba6bd353161fab456b423e93571ab027d5423c Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Wed, 20 Jan 2021 15:59:00 +0100 Subject: New plugin hook: ability to add custom filters to Shaarli search engine A new plugin hook has been added: hook_test_filter_search_entry This hook allows to filter out bookmark with custom plugin code when a search is performed. Related to #143 --- tests/netscape/BookmarkExportTest.php | 13 ++++++++++++- tests/netscape/BookmarkImportTest.php | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) (limited to 'tests/netscape') diff --git a/tests/netscape/BookmarkExportTest.php b/tests/netscape/BookmarkExportTest.php index ad288f78..b8a88cd8 100644 --- a/tests/netscape/BookmarkExportTest.php +++ b/tests/netscape/BookmarkExportTest.php @@ -8,6 +8,7 @@ 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'; @@ -47,6 +48,9 @@ class BookmarkExportTest extends TestCase */ protected static $history; + /** @var PluginManager */ + protected static $pluginManager; + /** * @var NetscapeBookmarkUtils */ @@ -63,7 +67,14 @@ class BookmarkExportTest extends TestCase static::$refDb = new \ReferenceLinkDB(); static::$refDb->write(static::$testDatastore); static::$history = new History('sandbox/history.php'); - static::$bookmarkService = new BookmarkFileService(static::$conf, static::$history, $mutex, 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'); } diff --git a/tests/netscape/BookmarkImportTest.php b/tests/netscape/BookmarkImportTest.php index 6856ebca..ecd33ea1 100644 --- a/tests/netscape/BookmarkImportTest.php +++ b/tests/netscape/BookmarkImportTest.php @@ -10,6 +10,7 @@ use Shaarli\Bookmark\BookmarkFileService; use Shaarli\Bookmark\BookmarkFilter; use Shaarli\Config\ConfigManager; use Shaarli\History; +use Shaarli\Plugin\PluginManager; use Shaarli\TestCase; use Slim\Http\UploadedFile; @@ -71,6 +72,9 @@ class BookmarkImportTest extends TestCase */ protected $netscapeBookmarkUtils; + /** @var PluginManager */ + protected $pluginManager; + /** * @var string Save the current timezone. */ @@ -99,7 +103,14 @@ class BookmarkImportTest extends TestCase $this->conf->set('resource.page_cache', $this->pagecache); $this->conf->set('resource.datastore', self::$testDatastore); $this->history = new History(self::$historyFilePath); - $this->bookmarkService = new BookmarkFileService($this->conf, $this->history, $mutex, true); + $this->pluginManager = new PluginManager($this->conf); + $this->bookmarkService = new BookmarkFileService( + $this->conf, + $this->pluginManager, + $this->history, + $mutex, + true + ); $this->netscapeBookmarkUtils = new NetscapeBookmarkUtils($this->bookmarkService, $this->conf, $this->history); } -- cgit v1.2.3