namespace Shaarli\Bookmark;
-use PHPUnit\Framework\TestCase;
+use malkusch\lock\mutex\NoMutex;
use Shaarli\Config\ConfigManager;
use Shaarli\History;
+use Shaarli\TestCase;
/**
* Class BookmarkInitializerTest
/** @var BookmarkInitializer instance */
protected $initializer;
+ /** @var NoMutex */
+ protected $mutex;
+
/**
* Initialize an empty BookmarkFileService
*/
public function setUp(): void
{
+ $this->mutex = new NoMutex();
if (file_exists(self::$testDatastore)) {
unlink(self::$testDatastore);
}
$this->conf = new ConfigManager(self::$testConf);
$this->conf->set('resource.datastore', self::$testDatastore);
$this->history = new History('sandbox/history.php');
- $this->bookmarkService = new BookmarkFileService($this->conf, $this->history, true);
+ $this->bookmarkService = new BookmarkFileService($this->conf, $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->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->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->history, $this->mutex, true);
$this->initializer->initialize();