diff options
author | ArthurHoaro <arthur@hoa.ro> | 2021-02-04 11:11:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-04 11:11:33 +0100 |
commit | 9db1ccdf2ce8381e1f3acb581d3c6a6def095d8c (patch) | |
tree | 97a618b77d327a5f963c91522988e24db5a9e158 /tests/api/controllers/links | |
parent | 8997ae6c8e24286f7d47981eaf905e80d2481c10 (diff) | |
parent | bcba6bd353161fab456b423e93571ab027d5423c (diff) | |
download | Shaarli-9db1ccdf2ce8381e1f3acb581d3c6a6def095d8c.tar.gz Shaarli-9db1ccdf2ce8381e1f3acb581d3c6a6def095d8c.tar.zst Shaarli-9db1ccdf2ce8381e1f3acb581d3c6a6def095d8c.zip |
New plugin hook: ability to add custom filters to Shaarli search engine
Diffstat (limited to 'tests/api/controllers/links')
-rw-r--r-- | tests/api/controllers/links/DeleteLinkTest.php | 21 | ||||
-rw-r--r-- | tests/api/controllers/links/GetLinkIdTest.php | 10 | ||||
-rw-r--r-- | tests/api/controllers/links/GetLinksTest.php | 10 | ||||
-rw-r--r-- | tests/api/controllers/links/PostLinkTest.php | 11 | ||||
-rw-r--r-- | tests/api/controllers/links/PutLinkTest.php | 11 |
5 files changed, 55 insertions, 8 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; | |||
7 | use Shaarli\Bookmark\BookmarkFileService; | 7 | use Shaarli\Bookmark\BookmarkFileService; |
8 | use Shaarli\Config\ConfigManager; | 8 | use Shaarli\Config\ConfigManager; |
9 | use Shaarli\History; | 9 | use Shaarli\History; |
10 | use Shaarli\Plugin\PluginManager; | ||
10 | use Slim\Container; | 11 | use Slim\Container; |
11 | use Slim\Http\Environment; | 12 | use Slim\Http\Environment; |
12 | use Slim\Http\Request; | 13 | use 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]; |
diff --git a/tests/api/controllers/links/GetLinkIdTest.php b/tests/api/controllers/links/GetLinkIdTest.php index 1ec56ef3..c93a3b4b 100644 --- a/tests/api/controllers/links/GetLinkIdTest.php +++ b/tests/api/controllers/links/GetLinkIdTest.php | |||
@@ -7,6 +7,7 @@ use Shaarli\Bookmark\Bookmark; | |||
7 | use Shaarli\Bookmark\BookmarkFileService; | 7 | use Shaarli\Bookmark\BookmarkFileService; |
8 | use Shaarli\Config\ConfigManager; | 8 | use Shaarli\Config\ConfigManager; |
9 | use Shaarli\History; | 9 | use Shaarli\History; |
10 | use Shaarli\Plugin\PluginManager; | ||
10 | use Slim\Container; | 11 | use Slim\Container; |
11 | use Slim\Http\Environment; | 12 | use Slim\Http\Environment; |
12 | use Slim\Http\Request; | 13 | use Slim\Http\Request; |
@@ -67,7 +68,14 @@ class GetLinkIdTest extends \Shaarli\TestCase | |||
67 | 68 | ||
68 | $this->container = new Container(); | 69 | $this->container = new Container(); |
69 | $this->container['conf'] = $this->conf; | 70 | $this->container['conf'] = $this->conf; |
70 | $this->container['db'] = new BookmarkFileService($this->conf, $history, $mutex, true); | 71 | $pluginManager = new PluginManager($this->conf); |
72 | $this->container['db'] = new BookmarkFileService( | ||
73 | $this->conf, | ||
74 | $pluginManager, | ||
75 | $history, | ||
76 | $mutex, | ||
77 | true | ||
78 | ); | ||
71 | $this->container['history'] = null; | 79 | $this->container['history'] = null; |
72 | 80 | ||
73 | $this->controller = new Links($this->container); | 81 | $this->controller = new Links($this->container); |
diff --git a/tests/api/controllers/links/GetLinksTest.php b/tests/api/controllers/links/GetLinksTest.php index b1c46ee2..3c966732 100644 --- a/tests/api/controllers/links/GetLinksTest.php +++ b/tests/api/controllers/links/GetLinksTest.php | |||
@@ -7,6 +7,7 @@ use Shaarli\Bookmark\BookmarkFileService; | |||
7 | use Shaarli\Bookmark\LinkDB; | 7 | use Shaarli\Bookmark\LinkDB; |
8 | use Shaarli\Config\ConfigManager; | 8 | use Shaarli\Config\ConfigManager; |
9 | use Shaarli\History; | 9 | use Shaarli\History; |
10 | use Shaarli\Plugin\PluginManager; | ||
10 | use Slim\Container; | 11 | use Slim\Container; |
11 | use Slim\Http\Environment; | 12 | use Slim\Http\Environment; |
12 | use Slim\Http\Request; | 13 | use Slim\Http\Request; |
@@ -67,7 +68,14 @@ class GetLinksTest extends \Shaarli\TestCase | |||
67 | 68 | ||
68 | $this->container = new Container(); | 69 | $this->container = new Container(); |
69 | $this->container['conf'] = $this->conf; | 70 | $this->container['conf'] = $this->conf; |
70 | $this->container['db'] = new BookmarkFileService($this->conf, $history, $mutex, true); | 71 | $pluginManager = new PluginManager($this->conf); |
72 | $this->container['db'] = new BookmarkFileService( | ||
73 | $this->conf, | ||
74 | $pluginManager, | ||
75 | $history, | ||
76 | $mutex, | ||
77 | true | ||
78 | ); | ||
71 | $this->container['history'] = null; | 79 | $this->container['history'] = null; |
72 | 80 | ||
73 | $this->controller = new Links($this->container); | 81 | $this->controller = new Links($this->container); |
diff --git a/tests/api/controllers/links/PostLinkTest.php b/tests/api/controllers/links/PostLinkTest.php index f755e2d2..a54e4a16 100644 --- a/tests/api/controllers/links/PostLinkTest.php +++ b/tests/api/controllers/links/PostLinkTest.php | |||
@@ -7,6 +7,7 @@ use Shaarli\Bookmark\Bookmark; | |||
7 | use Shaarli\Bookmark\BookmarkFileService; | 7 | use Shaarli\Bookmark\BookmarkFileService; |
8 | use Shaarli\Config\ConfigManager; | 8 | use Shaarli\Config\ConfigManager; |
9 | use Shaarli\History; | 9 | use Shaarli\History; |
10 | use Shaarli\Plugin\PluginManager; | ||
10 | use Shaarli\TestCase; | 11 | use Shaarli\TestCase; |
11 | use Slim\Container; | 12 | use Slim\Container; |
12 | use Slim\Http\Environment; | 13 | use Slim\Http\Environment; |
@@ -81,8 +82,14 @@ class PostLinkTest extends TestCase | |||
81 | $refHistory = new \ReferenceHistory(); | 82 | $refHistory = new \ReferenceHistory(); |
82 | $refHistory->write(self::$testHistory); | 83 | $refHistory->write(self::$testHistory); |
83 | $this->history = new History(self::$testHistory); | 84 | $this->history = new History(self::$testHistory); |
84 | $this->bookmarkService = new BookmarkFileService($this->conf, $this->history, $mutex, true); | 85 | $pluginManager = new PluginManager($this->conf); |
85 | 86 | $this->bookmarkService = new BookmarkFileService( | |
87 | $this->conf, | ||
88 | $pluginManager, | ||
89 | $this->history, | ||
90 | $mutex, | ||
91 | true | ||
92 | ); | ||
86 | $this->container = new Container(); | 93 | $this->container = new Container(); |
87 | $this->container['conf'] = $this->conf; | 94 | $this->container['conf'] = $this->conf; |
88 | $this->container['db'] = $this->bookmarkService; | 95 | $this->container['db'] = $this->bookmarkService; |
diff --git a/tests/api/controllers/links/PutLinkTest.php b/tests/api/controllers/links/PutLinkTest.php index fe24f2eb..ed14d5f8 100644 --- a/tests/api/controllers/links/PutLinkTest.php +++ b/tests/api/controllers/links/PutLinkTest.php | |||
@@ -8,6 +8,7 @@ use Shaarli\Bookmark\Bookmark; | |||
8 | use Shaarli\Bookmark\BookmarkFileService; | 8 | use Shaarli\Bookmark\BookmarkFileService; |
9 | use Shaarli\Config\ConfigManager; | 9 | use Shaarli\Config\ConfigManager; |
10 | use Shaarli\History; | 10 | use Shaarli\History; |
11 | use Shaarli\Plugin\PluginManager; | ||
11 | use Slim\Container; | 12 | use Slim\Container; |
12 | use Slim\Http\Environment; | 13 | use Slim\Http\Environment; |
13 | use Slim\Http\Request; | 14 | use Slim\Http\Request; |
@@ -73,8 +74,14 @@ class PutLinkTest extends \Shaarli\TestCase | |||
73 | $refHistory = new \ReferenceHistory(); | 74 | $refHistory = new \ReferenceHistory(); |
74 | $refHistory->write(self::$testHistory); | 75 | $refHistory->write(self::$testHistory); |
75 | $this->history = new History(self::$testHistory); | 76 | $this->history = new History(self::$testHistory); |
76 | $this->bookmarkService = new BookmarkFileService($this->conf, $this->history, $mutex, true); | 77 | $pluginManager = new PluginManager($this->conf); |
77 | 78 | $this->bookmarkService = new BookmarkFileService( | |
79 | $this->conf, | ||
80 | $pluginManager, | ||
81 | $this->history, | ||
82 | $mutex, | ||
83 | true | ||
84 | ); | ||
78 | $this->container = new Container(); | 85 | $this->container = new Container(); |
79 | $this->container['conf'] = $this->conf; | 86 | $this->container['conf'] = $this->conf; |
80 | $this->container['db'] = $this->bookmarkService; | 87 | $this->container['db'] = $this->bookmarkService; |