namespace Shaarli\Api\Controllers;
+use malkusch\lock\mutex\NoMutex;
use Shaarli\Bookmark\BookmarkFileService;
use Shaarli\Config\ConfigManager;
use Shaarli\History;
+use Shaarli\Plugin\PluginManager;
use Slim\Container;
use Slim\Http\Environment;
use Slim\Http\Request;
use Slim\Http\Response;
-class DeleteLinkTest extends \PHPUnit\Framework\TestCase
+class DeleteLinkTest extends \Shaarli\TestCase
{
/**
* @var string datastore to test write operations
*/
protected $controller;
+ /** @var NoMutex */
+ protected $mutex;
+
+ /** @var PluginManager */
+ protected $pluginManager;
+
/**
* Before each test, instantiate a new Api with its config, plugins and bookmarks.
*/
protected function setUp(): void
{
+ $this->mutex = new NoMutex();
$this->conf = new ConfigManager('tests/utils/config/configJson');
$this->conf->set('resource.datastore', self::$testDatastore);
$this->refDB = new \ReferenceLinkDB();
$refHistory = new \ReferenceHistory();
$refHistory->write(self::$testHistory);
$this->history = new History(self::$testHistory);
- $this->bookmarkService = new BookmarkFileService($this->conf, $this->history, true);
+ $this->pluginManager = new PluginManager($this->conf);
+ $this->bookmarkService = new BookmarkFileService(
+ $this->conf,
+ $this->pluginManager,
+ $this->history,
+ $this->mutex,
+ true
+ );
$this->container = new Container();
$this->container['conf'] = $this->conf;
$this->assertEquals(204, $response->getStatusCode());
$this->assertEmpty((string) $response->getBody());
- $this->bookmarkService = new BookmarkFileService($this->conf, $this->history, true);
+ $this->bookmarkService = new BookmarkFileService(
+ $this->conf,
+ $this->pluginManager,
+ $this->history,
+ $this->mutex,
+ true
+ );
$this->assertFalse($this->bookmarkService->exists($id));
$historyEntry = $this->history->getHistory()[0];