namespace Shaarli\Bookmark;
+use malkusch\lock\mutex\NoMutex;
use Shaarli\Config\ConfigManager;
use Shaarli\History;
+use Shaarli\Plugin\PluginManager;
use Shaarli\TestCase;
/**
/** @var BookmarkInitializer instance */
protected $initializer;
+ /** @var NoMutex */
+ protected $mutex;
+
+ /** @var PluginManager */
+ protected $pluginManager;
+
/**
* Initialize an empty BookmarkFileService
*/
public function setUp(): void
{
+ $this->mutex = new NoMutex();
if (file_exists(self::$testDatastore)) {
unlink(self::$testDatastore);
}
copy('tests/utils/config/configJson.json.php', self::$testConf .'.json.php');
$this->conf = new ConfigManager(self::$testConf);
$this->conf->set('resource.datastore', self::$testDatastore);
+ $this->pluginManager = new PluginManager($this->conf);
$this->history = new History('sandbox/history.php');
- $this->bookmarkService = new BookmarkFileService($this->conf, $this->history, true);
+ $this->bookmarkService = new BookmarkFileService(
+ $this->conf,
+ $this->pluginManager,
+ $this->history,
+ $this->mutex,
+ true
+ );
$this->initializer = new BookmarkInitializer($this->bookmarkService);
}
{
$refDB = new \ReferenceLinkDB();
$refDB->write(self::$testDatastore);
- $this->bookmarkService = new BookmarkFileService($this->conf, $this->history, true);
+ $this->bookmarkService = new BookmarkFileService(
+ $this->conf,
+ $this->pluginManager,
+ $this->history,
+ $this->mutex,
+ true
+ );
$this->initializer = new BookmarkInitializer($this->bookmarkService);
$this->initializer->initialize();
$this->bookmarkService->save();
// Reload from file
- $this->bookmarkService = new BookmarkFileService($this->conf, $this->history, true);
+ $this->bookmarkService = new BookmarkFileService(
+ $this->conf,
+ $this->pluginManager,
+ $this->history,
+ $this->mutex,
+ true
+ );
$this->assertEquals($refDB->countLinks() + 3, $this->bookmarkService->count());
$bookmark = $this->bookmarkService->get(43);
public function testInitializeNonExistentDataStore(): void
{
$this->conf->set('resource.datastore', static::$testDatastore . '_empty');
- $this->bookmarkService = new BookmarkFileService($this->conf, $this->history, true);
+ $this->bookmarkService = new BookmarkFileService(
+ $this->conf,
+ $this->pluginManager,
+ $this->history,
+ $this->mutex,
+ true
+ );
$this->initializer->initialize();