aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/netscape
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-10-13 13:30:37 +0200
committerGitHub <noreply@github.com>2020-10-13 13:30:37 +0200
commit29c31b7ec6ca48ba37b7eb6da650931fd0cb7164 (patch)
treee4017d3c979604f40e78cdc305f0ab191aedd4b9 /tests/netscape
parent458b6b9918ec27154dd45416947bb93bedb97109 (diff)
parentfd1ddad98df45bc3c18be7980c1cbe68ce6b219c (diff)
downloadShaarli-29c31b7ec6ca48ba37b7eb6da650931fd0cb7164.tar.gz
Shaarli-29c31b7ec6ca48ba37b7eb6da650931fd0cb7164.tar.zst
Shaarli-29c31b7ec6ca48ba37b7eb6da650931fd0cb7164.zip
Merge pull request #1570 from ArthurHoaro/feature/datastore-mutex
Add mutex on datastore I/O operations
Diffstat (limited to 'tests/netscape')
-rw-r--r--tests/netscape/BookmarkExportTest.php4
-rw-r--r--tests/netscape/BookmarkImportTest.php4
2 files changed, 6 insertions, 2 deletions
diff --git a/tests/netscape/BookmarkExportTest.php b/tests/netscape/BookmarkExportTest.php
index 9b95ccc9..ad288f78 100644
--- a/tests/netscape/BookmarkExportTest.php
+++ b/tests/netscape/BookmarkExportTest.php
@@ -2,6 +2,7 @@
2 2
3namespace Shaarli\Netscape; 3namespace Shaarli\Netscape;
4 4
5use malkusch\lock\mutex\NoMutex;
5use Shaarli\Bookmark\BookmarkFileService; 6use Shaarli\Bookmark\BookmarkFileService;
6use Shaarli\Config\ConfigManager; 7use Shaarli\Config\ConfigManager;
7use Shaarli\Formatter\BookmarkFormatter; 8use Shaarli\Formatter\BookmarkFormatter;
@@ -56,12 +57,13 @@ class BookmarkExportTest extends TestCase
56 */ 57 */
57 public static function setUpBeforeClass(): void 58 public static function setUpBeforeClass(): void
58 { 59 {
60 $mutex = new NoMutex();
59 static::$conf = new ConfigManager('tests/utils/config/configJson'); 61 static::$conf = new ConfigManager('tests/utils/config/configJson');
60 static::$conf->set('resource.datastore', static::$testDatastore); 62 static::$conf->set('resource.datastore', static::$testDatastore);
61 static::$refDb = new \ReferenceLinkDB(); 63 static::$refDb = new \ReferenceLinkDB();
62 static::$refDb->write(static::$testDatastore); 64 static::$refDb->write(static::$testDatastore);
63 static::$history = new History('sandbox/history.php'); 65 static::$history = new History('sandbox/history.php');
64 static::$bookmarkService = new BookmarkFileService(static::$conf, static::$history, true); 66 static::$bookmarkService = new BookmarkFileService(static::$conf, static::$history, $mutex, true);
65 $factory = new FormatterFactory(static::$conf, true); 67 $factory = new FormatterFactory(static::$conf, true);
66 static::$formatter = $factory->getFormatter('raw'); 68 static::$formatter = $factory->getFormatter('raw');
67 } 69 }
diff --git a/tests/netscape/BookmarkImportTest.php b/tests/netscape/BookmarkImportTest.php
index c1e49b5f..c526d5c8 100644
--- a/tests/netscape/BookmarkImportTest.php
+++ b/tests/netscape/BookmarkImportTest.php
@@ -3,6 +3,7 @@
3namespace Shaarli\Netscape; 3namespace Shaarli\Netscape;
4 4
5use DateTime; 5use DateTime;
6use malkusch\lock\mutex\NoMutex;
6use Psr\Http\Message\UploadedFileInterface; 7use Psr\Http\Message\UploadedFileInterface;
7use Shaarli\Bookmark\Bookmark; 8use Shaarli\Bookmark\Bookmark;
8use Shaarli\Bookmark\BookmarkFileService; 9use Shaarli\Bookmark\BookmarkFileService;
@@ -87,6 +88,7 @@ class BookmarkImportTest extends TestCase
87 */ 88 */
88 protected function setUp(): void 89 protected function setUp(): void
89 { 90 {
91 $mutex = new NoMutex();
90 if (file_exists(self::$testDatastore)) { 92 if (file_exists(self::$testDatastore)) {
91 unlink(self::$testDatastore); 93 unlink(self::$testDatastore);
92 } 94 }
@@ -97,7 +99,7 @@ class BookmarkImportTest extends TestCase
97 $this->conf->set('resource.page_cache', $this->pagecache); 99 $this->conf->set('resource.page_cache', $this->pagecache);
98 $this->conf->set('resource.datastore', self::$testDatastore); 100 $this->conf->set('resource.datastore', self::$testDatastore);
99 $this->history = new History(self::$historyFilePath); 101 $this->history = new History(self::$historyFilePath);
100 $this->bookmarkService = new BookmarkFileService($this->conf, $this->history, true); 102 $this->bookmarkService = new BookmarkFileService($this->conf, $this->history, $mutex, true);
101 $this->netscapeBookmarkUtils = new NetscapeBookmarkUtils($this->bookmarkService, $this->conf, $this->history); 103 $this->netscapeBookmarkUtils = new NetscapeBookmarkUtils($this->bookmarkService, $this->conf, $this->history);
102 } 104 }
103 105