aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/api/controllers/links/DeleteLinkTest.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2021-01-20 15:59:00 +0100
committerArthurHoaro <arthur@hoa.ro>2021-02-04 11:02:50 +0100
commitbcba6bd353161fab456b423e93571ab027d5423c (patch)
tree97a618b77d327a5f963c91522988e24db5a9e158 /tests/api/controllers/links/DeleteLinkTest.php
parent8997ae6c8e24286f7d47981eaf905e80d2481c10 (diff)
downloadShaarli-bcba6bd353161fab456b423e93571ab027d5423c.tar.gz
Shaarli-bcba6bd353161fab456b423e93571ab027d5423c.tar.zst
Shaarli-bcba6bd353161fab456b423e93571ab027d5423c.zip
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
Diffstat (limited to 'tests/api/controllers/links/DeleteLinkTest.php')
-rw-r--r--tests/api/controllers/links/DeleteLinkTest.php21
1 files changed, 19 insertions, 2 deletions
diff --git a/tests/api/controllers/links/DeleteLinkTest.php b/tests/api/controllers/links/DeleteLinkTest.php
index 805c9be3..dc2cf917 100644
--- a/tests/api/controllers/links/DeleteLinkTest.php
+++ b/tests/api/controllers/links/DeleteLinkTest.php
@@ -7,6 +7,7 @@ use malkusch\lock\mutex\NoMutex;
7use Shaarli\Bookmark\BookmarkFileService; 7use Shaarli\Bookmark\BookmarkFileService;
8use Shaarli\Config\ConfigManager; 8use Shaarli\Config\ConfigManager;
9use Shaarli\History; 9use Shaarli\History;
10use Shaarli\Plugin\PluginManager;
10use Slim\Container; 11use Slim\Container;
11use Slim\Http\Environment; 12use Slim\Http\Environment;
12use Slim\Http\Request; 13use Slim\Http\Request;
@@ -57,6 +58,9 @@ class DeleteLinkTest extends \Shaarli\TestCase
57 /** @var NoMutex */ 58 /** @var NoMutex */
58 protected $mutex; 59 protected $mutex;
59 60
61 /** @var PluginManager */
62 protected $pluginManager;
63
60 /** 64 /**
61 * Before each test, instantiate a new Api with its config, plugins and bookmarks. 65 * Before each test, instantiate a new Api with its config, plugins and bookmarks.
62 */ 66 */
@@ -70,7 +74,14 @@ class DeleteLinkTest extends \Shaarli\TestCase
70 $refHistory = new \ReferenceHistory(); 74 $refHistory = new \ReferenceHistory();
71 $refHistory->write(self::$testHistory); 75 $refHistory->write(self::$testHistory);
72 $this->history = new History(self::$testHistory); 76 $this->history = new History(self::$testHistory);
73 $this->bookmarkService = new BookmarkFileService($this->conf, $this->history, $this->mutex, true); 77 $this->pluginManager = new PluginManager($this->conf);
78 $this->bookmarkService = new BookmarkFileService(
79 $this->conf,
80 $this->pluginManager,
81 $this->history,
82 $this->mutex,
83 true
84 );
74 85
75 $this->container = new Container(); 86 $this->container = new Container();
76 $this->container['conf'] = $this->conf; 87 $this->container['conf'] = $this->conf;
@@ -105,7 +116,13 @@ class DeleteLinkTest extends \Shaarli\TestCase
105 $this->assertEquals(204, $response->getStatusCode()); 116 $this->assertEquals(204, $response->getStatusCode());
106 $this->assertEmpty((string) $response->getBody()); 117 $this->assertEmpty((string) $response->getBody());
107 118
108 $this->bookmarkService = new BookmarkFileService($this->conf, $this->history, $this->mutex, true); 119 $this->bookmarkService = new BookmarkFileService(
120 $this->conf,
121 $this->pluginManager,
122 $this->history,
123 $this->mutex,
124 true
125 );
109 $this->assertFalse($this->bookmarkService->exists($id)); 126 $this->assertFalse($this->bookmarkService->exists($id));
110 127
111 $historyEntry = $this->history->getHistory()[0]; 128 $historyEntry = $this->history->getHistory()[0];