aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/bookmark
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2021-02-04 11:11:33 +0100
committerGitHub <noreply@github.com>2021-02-04 11:11:33 +0100
commit9db1ccdf2ce8381e1f3acb581d3c6a6def095d8c (patch)
tree97a618b77d327a5f963c91522988e24db5a9e158 /tests/bookmark
parent8997ae6c8e24286f7d47981eaf905e80d2481c10 (diff)
parentbcba6bd353161fab456b423e93571ab027d5423c (diff)
downloadShaarli-9db1ccdf2ce8381e1f3acb581d3c6a6def095d8c.tar.gz
Shaarli-9db1ccdf2ce8381e1f3acb581d3c6a6def095d8c.tar.zst
Shaarli-9db1ccdf2ce8381e1f3acb581d3c6a6def095d8c.zip
Merge pull request #1698 from ArthurHoaro/feature/plugins-search-filterHEADmaster
New plugin hook: ability to add custom filters to Shaarli search engine
Diffstat (limited to 'tests/bookmark')
-rw-r--r--tests/bookmark/BookmarkFileServiceTest.php137
-rw-r--r--tests/bookmark/BookmarkFilterTest.php65
-rw-r--r--tests/bookmark/BookmarkInitializerTest.php37
3 files changed, 157 insertions, 82 deletions
diff --git a/tests/bookmark/BookmarkFileServiceTest.php b/tests/bookmark/BookmarkFileServiceTest.php
index d1af3fb0..1d250719 100644
--- a/tests/bookmark/BookmarkFileServiceTest.php
+++ b/tests/bookmark/BookmarkFileServiceTest.php
@@ -14,6 +14,7 @@ use Shaarli\Bookmark\Exception\BookmarkNotFoundException;
14use Shaarli\Config\ConfigManager; 14use Shaarli\Config\ConfigManager;
15use Shaarli\Formatter\BookmarkMarkdownFormatter; 15use Shaarli\Formatter\BookmarkMarkdownFormatter;
16use Shaarli\History; 16use Shaarli\History;
17use Shaarli\Plugin\PluginManager;
17use Shaarli\TestCase; 18use Shaarli\TestCase;
18 19
19/** 20/**
@@ -56,6 +57,9 @@ class BookmarkFileServiceTest extends TestCase
56 /** @var NoMutex */ 57 /** @var NoMutex */
57 protected $mutex; 58 protected $mutex;
58 59
60 /** @var PluginManager */
61 protected $pluginManager;
62
59 /** 63 /**
60 * Instantiates public and private LinkDBs with test data 64 * Instantiates public and private LinkDBs with test data
61 * 65 *
@@ -93,8 +97,21 @@ class BookmarkFileServiceTest extends TestCase
93 $this->refDB = new \ReferenceLinkDB(); 97 $this->refDB = new \ReferenceLinkDB();
94 $this->refDB->write(self::$testDatastore); 98 $this->refDB->write(self::$testDatastore);
95 $this->history = new History('sandbox/history.php'); 99 $this->history = new History('sandbox/history.php');
96 $this->publicLinkDB = new BookmarkFileService($this->conf, $this->history, $this->mutex, false); 100 $this->pluginManager = new PluginManager($this->conf);
97 $this->privateLinkDB = new BookmarkFileService($this->conf, $this->history, $this->mutex, true); 101 $this->publicLinkDB = new BookmarkFileService(
102 $this->conf,
103 $this->pluginManager,
104 $this->history,
105 $this->mutex,
106 false
107 );
108 $this->privateLinkDB = new BookmarkFileService(
109 $this->conf,
110 $this->pluginManager,
111 $this->history,
112 $this->mutex,
113 true
114 );
98 } 115 }
99 116
100 /** 117 /**
@@ -111,7 +128,13 @@ class BookmarkFileServiceTest extends TestCase
111 $db = self::getMethod('migrate'); 128 $db = self::getMethod('migrate');
112 $db->invokeArgs($this->privateLinkDB, []); 129 $db->invokeArgs($this->privateLinkDB, []);
113 130
114 $db = new \FakeBookmarkService($this->conf, $this->history, $this->mutex, true); 131 $db = new \FakeBookmarkService(
132 $this->conf,
133 $this->pluginManager,
134 $this->history,
135 $this->mutex,
136 true
137 );
115 $this->assertInstanceOf(BookmarkArray::class, $db->getBookmarks()); 138 $this->assertInstanceOf(BookmarkArray::class, $db->getBookmarks());
116 $this->assertEquals($this->refDB->countLinks(), $db->count()); 139 $this->assertEquals($this->refDB->countLinks(), $db->count());
117 } 140 }
@@ -180,7 +203,13 @@ class BookmarkFileServiceTest extends TestCase
180 $this->assertEquals($updated, $bookmark->getUpdated()); 203 $this->assertEquals($updated, $bookmark->getUpdated());
181 204
182 // reload from file 205 // reload from file
183 $this->privateLinkDB = new BookmarkFileService($this->conf, $this->history, $this->mutex, true); 206 $this->privateLinkDB = new \FakeBookmarkService(
207 $this->conf,
208 $this->pluginManager,
209 $this->history,
210 $this->mutex,
211 true
212 );
184 213
185 $bookmark = $this->privateLinkDB->get(43); 214 $bookmark = $this->privateLinkDB->get(43);
186 $this->assertEquals(43, $bookmark->getId()); 215 $this->assertEquals(43, $bookmark->getId());
@@ -218,7 +247,13 @@ class BookmarkFileServiceTest extends TestCase
218 $this->assertNull($bookmark->getUpdated()); 247 $this->assertNull($bookmark->getUpdated());
219 248
220 // reload from file 249 // reload from file
221 $this->privateLinkDB = new BookmarkFileService($this->conf, $this->history, $this->mutex, true); 250 $this->privateLinkDB = new BookmarkFileService(
251 $this->conf,
252 $this->pluginManager,
253 $this->history,
254 $this->mutex,
255 true
256 );
222 257
223 $bookmark = $this->privateLinkDB->get(43); 258 $bookmark = $this->privateLinkDB->get(43);
224 $this->assertEquals(43, $bookmark->getId()); 259 $this->assertEquals(43, $bookmark->getId());
@@ -248,7 +283,13 @@ class BookmarkFileServiceTest extends TestCase
248 $this->assertEquals(43, $bookmark->getId()); 283 $this->assertEquals(43, $bookmark->getId());
249 284
250 // reload from file 285 // reload from file
251 $this->privateLinkDB = new BookmarkFileService($this->conf, $this->history, $this->mutex, true); 286 $this->privateLinkDB = new BookmarkFileService(
287 $this->conf,
288 $this->pluginManager,
289 $this->history,
290 $this->mutex,
291 true
292 );
252 293
253 $this->privateLinkDB->get(43); 294 $this->privateLinkDB->get(43);
254 } 295 }
@@ -309,7 +350,13 @@ class BookmarkFileServiceTest extends TestCase
309 $this->assertTrue(new \DateTime('5 seconds ago') < $bookmark->getUpdated()); 350 $this->assertTrue(new \DateTime('5 seconds ago') < $bookmark->getUpdated());
310 351
311 // reload from file 352 // reload from file
312 $this->privateLinkDB = new BookmarkFileService($this->conf, $this->history, $this->mutex, true); 353 $this->privateLinkDB = new BookmarkFileService(
354 $this->conf,
355 $this->pluginManager,
356 $this->history,
357 $this->mutex,
358 true
359 );
313 360
314 $bookmark = $this->privateLinkDB->get(42); 361 $bookmark = $this->privateLinkDB->get(42);
315 $this->assertEquals(42, $bookmark->getId()); 362 $this->assertEquals(42, $bookmark->getId());
@@ -350,7 +397,13 @@ class BookmarkFileServiceTest extends TestCase
350 $this->assertTrue(new \DateTime('5 seconds ago') < $bookmark->getUpdated()); 397 $this->assertTrue(new \DateTime('5 seconds ago') < $bookmark->getUpdated());
351 398
352 // reload from file 399 // reload from file
353 $this->privateLinkDB = new BookmarkFileService($this->conf, $this->history, $this->mutex, true); 400 $this->privateLinkDB = new BookmarkFileService(
401 $this->conf,
402 $this->pluginManager,
403 $this->history,
404 $this->mutex,
405 true
406 );
354 407
355 $bookmark = $this->privateLinkDB->get(42); 408 $bookmark = $this->privateLinkDB->get(42);
356 $this->assertEquals(42, $bookmark->getId()); 409 $this->assertEquals(42, $bookmark->getId());
@@ -383,7 +436,13 @@ class BookmarkFileServiceTest extends TestCase
383 $this->assertEquals($title, $bookmark->getTitle()); 436 $this->assertEquals($title, $bookmark->getTitle());
384 437
385 // reload from file 438 // reload from file
386 $this->privateLinkDB = new BookmarkFileService($this->conf, $this->history, $this->mutex, true); 439 $this->privateLinkDB = new BookmarkFileService(
440 $this->conf,
441 $this->pluginManager,
442 $this->history,
443 $this->mutex,
444 true
445 );
387 446
388 $bookmark = $this->privateLinkDB->get(42); 447 $bookmark = $this->privateLinkDB->get(42);
389 $this->assertEquals(42, $bookmark->getId()); 448 $this->assertEquals(42, $bookmark->getId());
@@ -436,7 +495,13 @@ class BookmarkFileServiceTest extends TestCase
436 $this->assertEquals(43, $bookmark->getId()); 495 $this->assertEquals(43, $bookmark->getId());
437 496
438 // reload from file 497 // reload from file
439 $this->privateLinkDB = new BookmarkFileService($this->conf, $this->history, $this->mutex, true); 498 $this->privateLinkDB = new BookmarkFileService(
499 $this->conf,
500 $this->pluginManager,
501 $this->history,
502 $this->mutex,
503 true
504 );
440 505
441 $bookmark = $this->privateLinkDB->get(43); 506 $bookmark = $this->privateLinkDB->get(43);
442 $this->assertEquals(43, $bookmark->getId()); 507 $this->assertEquals(43, $bookmark->getId());
@@ -456,7 +521,13 @@ class BookmarkFileServiceTest extends TestCase
456 $this->assertEquals($title, $bookmark->getTitle()); 521 $this->assertEquals($title, $bookmark->getTitle());
457 522
458 // reload from file 523 // reload from file
459 $this->privateLinkDB = new BookmarkFileService($this->conf, $this->history, $this->mutex, true); 524 $this->privateLinkDB = new BookmarkFileService(
525 $this->conf,
526 $this->pluginManager,
527 $this->history,
528 $this->mutex,
529 true
530 );
460 531
461 $bookmark = $this->privateLinkDB->get(42); 532 $bookmark = $this->privateLinkDB->get(42);
462 $this->assertEquals(42, $bookmark->getId()); 533 $this->assertEquals(42, $bookmark->getId());
@@ -488,7 +559,13 @@ class BookmarkFileServiceTest extends TestCase
488 $this->assertEquals($title, $bookmark->getTitle()); 559 $this->assertEquals($title, $bookmark->getTitle());
489 560
490 // reload from file 561 // reload from file
491 $this->privateLinkDB = new BookmarkFileService($this->conf, $this->history, $this->mutex, true); 562 $this->privateLinkDB = new BookmarkFileService(
563 $this->conf,
564 $this->pluginManager,
565 $this->history,
566 $this->mutex,
567 true
568 );
492 569
493 $bookmark = $this->privateLinkDB->get(42); 570 $bookmark = $this->privateLinkDB->get(42);
494 $this->assertEquals(42, $bookmark->getId()); 571 $this->assertEquals(42, $bookmark->getId());
@@ -514,7 +591,13 @@ class BookmarkFileServiceTest extends TestCase
514 $this->assertInstanceOf(BookmarkNotFoundException::class, $exception); 591 $this->assertInstanceOf(BookmarkNotFoundException::class, $exception);
515 592
516 // reload from file 593 // reload from file
517 $this->privateLinkDB = new BookmarkFileService($this->conf, $this->history, $this->mutex, true); 594 $this->privateLinkDB = new BookmarkFileService(
595 $this->conf,
596 $this->pluginManager,
597 $this->history,
598 $this->mutex,
599 true
600 );
518 601
519 $this->privateLinkDB->get(42); 602 $this->privateLinkDB->get(42);
520 } 603 }
@@ -607,7 +690,7 @@ class BookmarkFileServiceTest extends TestCase
607 690
608 $conf = new ConfigManager('tests/utils/config/configJson'); 691 $conf = new ConfigManager('tests/utils/config/configJson');
609 $conf->set('resource.datastore', 'null/store.db'); 692 $conf->set('resource.datastore', 'null/store.db');
610 new BookmarkFileService($conf, $this->history, $this->mutex, true); 693 new BookmarkFileService($conf, $this->pluginManager, $this->history, $this->mutex, true);
611 } 694 }
612 695
613 /** 696 /**
@@ -617,7 +700,7 @@ class BookmarkFileServiceTest extends TestCase
617 { 700 {
618 unlink(self::$testDatastore); 701 unlink(self::$testDatastore);
619 $this->assertFileNotExists(self::$testDatastore); 702 $this->assertFileNotExists(self::$testDatastore);
620 new BookmarkFileService($this->conf, $this->history, $this->mutex, true); 703 new BookmarkFileService($this->conf, $this->pluginManager, $this->history, $this->mutex, true);
621 $this->assertFileExists(self::$testDatastore); 704 $this->assertFileExists(self::$testDatastore);
622 705
623 // ensure the correct data has been written 706 // ensure the correct data has been written
@@ -631,7 +714,7 @@ class BookmarkFileServiceTest extends TestCase
631 { 714 {
632 unlink(self::$testDatastore); 715 unlink(self::$testDatastore);
633 $this->assertFileNotExists(self::$testDatastore); 716 $this->assertFileNotExists(self::$testDatastore);
634 $db = new \FakeBookmarkService($this->conf, $this->history, $this->mutex, false); 717 $db = new \FakeBookmarkService($this->conf, $this->pluginManager, $this->history, $this->mutex, false);
635 $this->assertFileNotExists(self::$testDatastore); 718 $this->assertFileNotExists(self::$testDatastore);
636 $this->assertInstanceOf(BookmarkArray::class, $db->getBookmarks()); 719 $this->assertInstanceOf(BookmarkArray::class, $db->getBookmarks());
637 $this->assertCount(0, $db->getBookmarks()); 720 $this->assertCount(0, $db->getBookmarks());
@@ -664,13 +747,13 @@ class BookmarkFileServiceTest extends TestCase
664 */ 747 */
665 public function testSave() 748 public function testSave()
666 { 749 {
667 $testDB = new BookmarkFileService($this->conf, $this->history, $this->mutex, true); 750 $testDB = new BookmarkFileService($this->conf, $this->pluginManager, $this->history, $this->mutex, true);
668 $dbSize = $testDB->count(); 751 $dbSize = $testDB->count();
669 752
670 $bookmark = new Bookmark(); 753 $bookmark = new Bookmark();
671 $testDB->add($bookmark); 754 $testDB->add($bookmark);
672 755
673 $testDB = new BookmarkFileService($this->conf, $this->history, $this->mutex, true); 756 $testDB = new BookmarkFileService($this->conf, $this->pluginManager, $this->history, $this->mutex, true);
674 $this->assertEquals($dbSize + 1, $testDB->count()); 757 $this->assertEquals($dbSize + 1, $testDB->count());
675 } 758 }
676 759
@@ -680,7 +763,7 @@ class BookmarkFileServiceTest extends TestCase
680 public function testCountHiddenPublic() 763 public function testCountHiddenPublic()
681 { 764 {
682 $this->conf->set('privacy.hide_public_links', true); 765 $this->conf->set('privacy.hide_public_links', true);
683 $linkDB = new BookmarkFileService($this->conf, $this->history, $this->mutex, false); 766 $linkDB = new BookmarkFileService($this->conf, $this->pluginManager, $this->history, $this->mutex, false);
684 767
685 $this->assertEquals(0, $linkDB->count()); 768 $this->assertEquals(0, $linkDB->count());
686 } 769 }
@@ -906,7 +989,13 @@ class BookmarkFileServiceTest extends TestCase
906 $bookmark->addAdditionalContentEntry('private_key', $privateKey); 989 $bookmark->addAdditionalContentEntry('private_key', $privateKey);
907 $this->privateLinkDB->save(); 990 $this->privateLinkDB->save();
908 991
909 $this->privateLinkDB = new BookmarkFileService($this->conf, $this->history, $this->mutex, false); 992 $this->privateLinkDB = new BookmarkFileService(
993 $this->conf,
994 $this->pluginManager,
995 $this->history,
996 $this->mutex,
997 false
998 );
910 $bookmark = $this->privateLinkDB->findByHash($hash, $privateKey); 999 $bookmark = $this->privateLinkDB->findByHash($hash, $privateKey);
911 1000
912 static::assertSame(6, $bookmark->getId()); 1001 static::assertSame(6, $bookmark->getId());
@@ -1152,7 +1241,13 @@ class BookmarkFileServiceTest extends TestCase
1152 public function testGetLatestEmptyDatastore(): void 1241 public function testGetLatestEmptyDatastore(): void
1153 { 1242 {
1154 unlink($this->conf->get('resource.datastore')); 1243 unlink($this->conf->get('resource.datastore'));
1155 $this->publicLinkDB = new BookmarkFileService($this->conf, $this->history, $this->mutex, false); 1244 $this->publicLinkDB = new BookmarkFileService(
1245 $this->conf,
1246 $this->pluginManager,
1247 $this->history,
1248 $this->mutex,
1249 false
1250 );
1156 1251
1157 $bookmark = $this->publicLinkDB->getLatest(); 1252 $bookmark = $this->publicLinkDB->getLatest();
1158 1253
diff --git a/tests/bookmark/BookmarkFilterTest.php b/tests/bookmark/BookmarkFilterTest.php
index 835674f2..79be807d 100644
--- a/tests/bookmark/BookmarkFilterTest.php
+++ b/tests/bookmark/BookmarkFilterTest.php
@@ -6,6 +6,7 @@ use malkusch\lock\mutex\NoMutex;
6use ReferenceLinkDB; 6use ReferenceLinkDB;
7use Shaarli\Config\ConfigManager; 7use Shaarli\Config\ConfigManager;
8use Shaarli\History; 8use Shaarli\History;
9use Shaarli\Plugin\PluginManager;
9use Shaarli\TestCase; 10use Shaarli\TestCase;
10 11
11/** 12/**
@@ -32,19 +33,24 @@ class BookmarkFilterTest extends TestCase
32 */ 33 */
33 protected static $bookmarkService; 34 protected static $bookmarkService;
34 35
36 /** @var PluginManager */
37 protected static $pluginManager;
38
35 /** 39 /**
36 * Instantiate linkFilter with ReferenceLinkDB data. 40 * Instantiate linkFilter with ReferenceLinkDB data.
37 */ 41 */
38 public static function setUpBeforeClass(): void 42 public static function setUpBeforeClass(): void
39 { 43 {
44
40 $mutex = new NoMutex(); 45 $mutex = new NoMutex();
41 $conf = new ConfigManager('tests/utils/config/configJson'); 46 $conf = new ConfigManager('tests/utils/config/configJson');
42 $conf->set('resource.datastore', self::$testDatastore); 47 $conf->set('resource.datastore', self::$testDatastore);
48 static::$pluginManager = new PluginManager($conf);
43 self::$refDB = new \ReferenceLinkDB(); 49 self::$refDB = new \ReferenceLinkDB();
44 self::$refDB->write(self::$testDatastore); 50 self::$refDB->write(self::$testDatastore);
45 $history = new History('sandbox/history.php'); 51 $history = new History('sandbox/history.php');
46 self::$bookmarkService = new \FakeBookmarkService($conf, $history, $mutex, true); 52 self::$bookmarkService = new \FakeBookmarkService($conf, static::$pluginManager, $history, $mutex, true);
47 self::$linkFilter = new BookmarkFilter(self::$bookmarkService->getBookmarks(), $conf); 53 self::$linkFilter = new BookmarkFilter(self::$bookmarkService->getBookmarks(), $conf, static::$pluginManager);
48 } 54 }
49 55
50 /** 56 /**
@@ -179,61 +185,6 @@ class BookmarkFilterTest extends TestCase
179 } 185 }
180 186
181 /** 187 /**
182 * Return bookmarks for a given day
183 */
184 public function testFilterDay()
185 {
186 $this->assertEquals(
187 4,
188 count(self::$linkFilter->filter(BookmarkFilter::$FILTER_DAY, '20121206'))
189 );
190 }
191
192 /**
193 * Return bookmarks for a given day
194 */
195 public function testFilterDayRestrictedVisibility(): void
196 {
197 $this->assertEquals(
198 3,
199 count(self::$linkFilter->filter(BookmarkFilter::$FILTER_DAY, '20121206', false, BookmarkFilter::$PUBLIC))
200 );
201 }
202
203 /**
204 * 404 - day not found
205 */
206 public function testFilterUnknownDay()
207 {
208 $this->assertEquals(
209 0,
210 count(self::$linkFilter->filter(BookmarkFilter::$FILTER_DAY, '19700101'))
211 );
212 }
213
214 /**
215 * Use an invalid date format
216 */
217 public function testFilterInvalidDayWithChars()
218 {
219 $this->expectException(\Exception::class);
220 $this->expectExceptionMessageRegExp('/Invalid date format/');
221
222 self::$linkFilter->filter(BookmarkFilter::$FILTER_DAY, 'Rainy day, dream away');
223 }
224
225 /**
226 * Use an invalid date format
227 */
228 public function testFilterInvalidDayDigits()
229 {
230 $this->expectException(\Exception::class);
231 $this->expectExceptionMessageRegExp('/Invalid date format/');
232
233 self::$linkFilter->filter(BookmarkFilter::$FILTER_DAY, '20');
234 }
235
236 /**
237 * Retrieve a link entry with its hash 188 * Retrieve a link entry with its hash
238 */ 189 */
239 public function testFilterSmallHash() 190 public function testFilterSmallHash()
diff --git a/tests/bookmark/BookmarkInitializerTest.php b/tests/bookmark/BookmarkInitializerTest.php
index 0c8420ce..351807c1 100644
--- a/tests/bookmark/BookmarkInitializerTest.php
+++ b/tests/bookmark/BookmarkInitializerTest.php
@@ -5,6 +5,7 @@ namespace Shaarli\Bookmark;
5use malkusch\lock\mutex\NoMutex; 5use malkusch\lock\mutex\NoMutex;
6use Shaarli\Config\ConfigManager; 6use Shaarli\Config\ConfigManager;
7use Shaarli\History; 7use Shaarli\History;
8use Shaarli\Plugin\PluginManager;
8use Shaarli\TestCase; 9use Shaarli\TestCase;
9 10
10/** 11/**
@@ -38,6 +39,9 @@ class BookmarkInitializerTest extends TestCase
38 /** @var NoMutex */ 39 /** @var NoMutex */
39 protected $mutex; 40 protected $mutex;
40 41
42 /** @var PluginManager */
43 protected $pluginManager;
44
41 /** 45 /**
42 * Initialize an empty BookmarkFileService 46 * Initialize an empty BookmarkFileService
43 */ 47 */
@@ -51,8 +55,15 @@ class BookmarkInitializerTest extends TestCase
51 copy('tests/utils/config/configJson.json.php', self::$testConf .'.json.php'); 55 copy('tests/utils/config/configJson.json.php', self::$testConf .'.json.php');
52 $this->conf = new ConfigManager(self::$testConf); 56 $this->conf = new ConfigManager(self::$testConf);
53 $this->conf->set('resource.datastore', self::$testDatastore); 57 $this->conf->set('resource.datastore', self::$testDatastore);
58 $this->pluginManager = new PluginManager($this->conf);
54 $this->history = new History('sandbox/history.php'); 59 $this->history = new History('sandbox/history.php');
55 $this->bookmarkService = new BookmarkFileService($this->conf, $this->history, $this->mutex, true); 60 $this->bookmarkService = new BookmarkFileService(
61 $this->conf,
62 $this->pluginManager,
63 $this->history,
64 $this->mutex,
65 true
66 );
56 67
57 $this->initializer = new BookmarkInitializer($this->bookmarkService); 68 $this->initializer = new BookmarkInitializer($this->bookmarkService);
58 } 69 }
@@ -64,7 +75,13 @@ class BookmarkInitializerTest extends TestCase
64 { 75 {
65 $refDB = new \ReferenceLinkDB(); 76 $refDB = new \ReferenceLinkDB();
66 $refDB->write(self::$testDatastore); 77 $refDB->write(self::$testDatastore);
67 $this->bookmarkService = new BookmarkFileService($this->conf, $this->history, $this->mutex, true); 78 $this->bookmarkService = new BookmarkFileService(
79 $this->conf,
80 $this->pluginManager,
81 $this->history,
82 $this->mutex,
83 true
84 );
68 $this->initializer = new BookmarkInitializer($this->bookmarkService); 85 $this->initializer = new BookmarkInitializer($this->bookmarkService);
69 86
70 $this->initializer->initialize(); 87 $this->initializer->initialize();
@@ -95,7 +112,13 @@ class BookmarkInitializerTest extends TestCase
95 $this->bookmarkService->save(); 112 $this->bookmarkService->save();
96 113
97 // Reload from file 114 // Reload from file
98 $this->bookmarkService = new BookmarkFileService($this->conf, $this->history, $this->mutex, true); 115 $this->bookmarkService = new BookmarkFileService(
116 $this->conf,
117 $this->pluginManager,
118 $this->history,
119 $this->mutex,
120 true
121 );
99 $this->assertEquals($refDB->countLinks() + 3, $this->bookmarkService->count()); 122 $this->assertEquals($refDB->countLinks() + 3, $this->bookmarkService->count());
100 123
101 $bookmark = $this->bookmarkService->get(43); 124 $bookmark = $this->bookmarkService->get(43);
@@ -126,7 +149,13 @@ class BookmarkInitializerTest extends TestCase
126 public function testInitializeNonExistentDataStore(): void 149 public function testInitializeNonExistentDataStore(): void
127 { 150 {
128 $this->conf->set('resource.datastore', static::$testDatastore . '_empty'); 151 $this->conf->set('resource.datastore', static::$testDatastore . '_empty');
129 $this->bookmarkService = new BookmarkFileService($this->conf, $this->history, $this->mutex, true); 152 $this->bookmarkService = new BookmarkFileService(
153 $this->conf,
154 $this->pluginManager,
155 $this->history,
156 $this->mutex,
157 true
158 );
130 159
131 $this->initializer->initialize(); 160 $this->initializer->initialize();
132 161