aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/api/controllers/links
diff options
context:
space:
mode:
Diffstat (limited to 'tests/api/controllers/links')
-rw-r--r--tests/api/controllers/links/DeleteLinkTest.php21
-rw-r--r--tests/api/controllers/links/GetLinkIdTest.php10
-rw-r--r--tests/api/controllers/links/GetLinksTest.php10
-rw-r--r--tests/api/controllers/links/PostLinkTest.php11
-rw-r--r--tests/api/controllers/links/PutLinkTest.php11
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;
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];
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;
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;
@@ -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;
7use Shaarli\Bookmark\LinkDB; 7use Shaarli\Bookmark\LinkDB;
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;
@@ -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;
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 Shaarli\TestCase; 11use Shaarli\TestCase;
11use Slim\Container; 12use Slim\Container;
12use Slim\Http\Environment; 13use 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;
8use Shaarli\Bookmark\BookmarkFileService; 8use Shaarli\Bookmark\BookmarkFileService;
9use Shaarli\Config\ConfigManager; 9use Shaarli\Config\ConfigManager;
10use Shaarli\History; 10use Shaarli\History;
11use Shaarli\Plugin\PluginManager;
11use Slim\Container; 12use Slim\Container;
12use Slim\Http\Environment; 13use Slim\Http\Environment;
13use Slim\Http\Request; 14use 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;