aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/bookmark/BookmarkInitializerTest.php
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/BookmarkInitializerTest.php
parent8997ae6c8e24286f7d47981eaf905e80d2481c10 (diff)
parentbcba6bd353161fab456b423e93571ab027d5423c (diff)
downloadShaarli-master.tar.gz
Shaarli-master.tar.zst
Shaarli-master.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/BookmarkInitializerTest.php')
-rw-r--r--tests/bookmark/BookmarkInitializerTest.php37
1 files changed, 33 insertions, 4 deletions
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