X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2Fapi%2Fcontrollers%2Ftags%2FGetTagsTest.php;h=a4b62c51b2c18e7b0fed1242fe9590f2a0abd9b9;hb=refs%2Fheads%2Fmaster;hp=98628c984f0fa9e12f2da7f7865bb6eb70155d3f;hpb=ff3b5dc5542ec150f0d9b447394364a15e9156d0;p=github%2Fshaarli%2FShaarli.git diff --git a/tests/api/controllers/tags/GetTagsTest.php b/tests/api/controllers/tags/GetTagsTest.php index 98628c98..a4b62c51 100644 --- a/tests/api/controllers/tags/GetTagsTest.php +++ b/tests/api/controllers/tags/GetTagsTest.php @@ -1,8 +1,12 @@ conf = new ConfigManager('tests/utils/config/configJson'); + $this->conf->set('resource.datastore', self::$testDatastore); $this->refDB = new \ReferenceLinkDB(); $this->refDB->write(self::$testDatastore); - + $history = new History('sandbox/history.php'); + $this->pluginManager = new PluginManager($this->conf); + $this->bookmarkService = new BookmarkFileService( + $this->conf, + $this->pluginManager, + $history, + $mutex, + true + ); $this->container = new Container(); $this->container['conf'] = $this->conf; - $this->linkDB = new LinkDB(self::$testDatastore, true, false); - $this->container['db'] = $this->linkDB; + $this->container['db'] = $this->bookmarkService; $this->container['history'] = null; $this->controller = new Tags($this->container); @@ -73,7 +89,7 @@ class GetTagsTest extends \PHPUnit\Framework\TestCase /** * After every test, remove the test datastore. */ - public function tearDown() + protected function tearDown(): void { @unlink(self::$testDatastore); } @@ -83,7 +99,7 @@ class GetTagsTest extends \PHPUnit\Framework\TestCase */ public function testGetTagsAll() { - $tags = $this->linkDB->linksCountPerTag(); + $tags = $this->bookmarkService->bookmarksCountPerTag(); $env = Environment::mock([ 'REQUEST_METHOD' => 'GET', ]); @@ -136,7 +152,7 @@ class GetTagsTest extends \PHPUnit\Framework\TestCase */ public function testGetTagsLimitAll() { - $tags = $this->linkDB->linksCountPerTag(); + $tags = $this->bookmarkService->bookmarksCountPerTag(); $env = Environment::mock([ 'REQUEST_METHOD' => 'GET', 'QUERY_STRING' => 'limit=all' @@ -170,7 +186,7 @@ class GetTagsTest extends \PHPUnit\Framework\TestCase */ public function testGetTagsVisibilityPrivate() { - $tags = $this->linkDB->linksCountPerTag([], 'private'); + $tags = $this->bookmarkService->bookmarksCountPerTag([], 'private'); $env = Environment::mock([ 'REQUEST_METHOD' => 'GET', 'QUERY_STRING' => 'visibility=private' @@ -190,7 +206,7 @@ class GetTagsTest extends \PHPUnit\Framework\TestCase */ public function testGetTagsVisibilityPublic() { - $tags = $this->linkDB->linksCountPerTag([], 'public'); + $tags = $this->bookmarkService->bookmarksCountPerTag([], 'public'); $env = Environment::mock( [ 'REQUEST_METHOD' => 'GET',