diff options
Diffstat (limited to 'tests/lib/SystemTag')
-rw-r--r-- | tests/lib/SystemTag/SystemTagManagerTest.php | 15 | ||||
-rw-r--r-- | tests/lib/SystemTag/SystemTagObjectMapperTest.php | 11 |
2 files changed, 15 insertions, 11 deletions
diff --git a/tests/lib/SystemTag/SystemTagManagerTest.php b/tests/lib/SystemTag/SystemTagManagerTest.php index 4627ebbf546..806c3fea240 100644 --- a/tests/lib/SystemTag/SystemTagManagerTest.php +++ b/tests/lib/SystemTag/SystemTagManagerTest.php @@ -16,8 +16,11 @@ use OCP\IDBConnection; use OCP\IGroupManager; use OCP\IUser; use OCP\IUserSession; +use OCP\Server; use OCP\SystemTag\ISystemTag; use OCP\SystemTag\ISystemTagManager; +use OCP\SystemTag\TagAlreadyExistsException; +use OCP\SystemTag\TagNotFoundException; use Test\TestCase; /** @@ -37,7 +40,7 @@ class SystemTagManagerTest extends TestCase { protected function setUp(): void { parent::setUp(); - $this->connection = \OC::$server->getDatabaseConnection(); + $this->connection = Server::get(IDBConnection::class); $this->dispatcher = $this->createMock(IEventDispatcher::class); $this->groupManager = $this->createMock(IGroupManager::class); @@ -239,7 +242,7 @@ class SystemTagManagerTest extends TestCase { * @dataProvider oneTagMultipleFlagsProvider */ public function testCreateDuplicate($name, $userVisible, $userAssignable): void { - $this->expectException(\OCP\SystemTag\TagAlreadyExistsException::class); + $this->expectException(TagAlreadyExistsException::class); try { $this->tagManager->createTag($name, $userVisible, $userAssignable); @@ -278,14 +281,14 @@ class SystemTagManagerTest extends TestCase { public function testGetNonExistingTag(): void { - $this->expectException(\OCP\SystemTag\TagNotFoundException::class); + $this->expectException(TagNotFoundException::class); $this->tagManager->getTag('nonexist', false, false); } public function testGetNonExistingTagsById(): void { - $this->expectException(\OCP\SystemTag\TagNotFoundException::class); + $this->expectException(TagNotFoundException::class); $tag1 = $this->tagManager->createTag('one', true, false); $this->tagManager->getTagsByIds([$tag1->getId(), 100, 101]); @@ -360,7 +363,7 @@ class SystemTagManagerTest extends TestCase { * @dataProvider updateTagProvider */ public function testUpdateTagDuplicate($tagCreate, $tagUpdated): void { - $this->expectException(\OCP\SystemTag\TagAlreadyExistsException::class); + $this->expectException(TagAlreadyExistsException::class); $this->tagManager->createTag( $tagCreate[0], @@ -396,7 +399,7 @@ class SystemTagManagerTest extends TestCase { public function testDeleteNonExistingTag(): void { - $this->expectException(\OCP\SystemTag\TagNotFoundException::class); + $this->expectException(TagNotFoundException::class); $this->tagManager->deleteTags([100]); } diff --git a/tests/lib/SystemTag/SystemTagObjectMapperTest.php b/tests/lib/SystemTag/SystemTagObjectMapperTest.php index 3569c98b5bc..a43bda3b659 100644 --- a/tests/lib/SystemTag/SystemTagObjectMapperTest.php +++ b/tests/lib/SystemTag/SystemTagObjectMapperTest.php @@ -13,6 +13,7 @@ use OC\SystemTag\SystemTagManager; use OC\SystemTag\SystemTagObjectMapper; use OCP\EventDispatcher\IEventDispatcher; use OCP\IDBConnection; +use OCP\Server; use OCP\SystemTag\ISystemTag; use OCP\SystemTag\ISystemTagManager; use OCP\SystemTag\ISystemTagObjectMapper; @@ -64,7 +65,7 @@ class SystemTagObjectMapperTest extends TestCase { protected function setUp(): void { parent::setUp(); - $this->connection = \OC::$server->getDatabaseConnection(); + $this->connection = Server::get(IDBConnection::class); $this->pruneTagsTables(); $this->tagManager = $this->createMock(ISystemTagManager::class); @@ -198,7 +199,7 @@ class SystemTagObjectMapperTest extends TestCase { public function testGetObjectsForNonExistingTag(): void { - $this->expectException(\OCP\SystemTag\TagNotFoundException::class); + $this->expectException(TagNotFoundException::class); $this->tagMapper->getObjectIdsForTags( [100], @@ -236,7 +237,7 @@ class SystemTagObjectMapperTest extends TestCase { public function testAssignNonExistingTags(): void { - $this->expectException(\OCP\SystemTag\TagNotFoundException::class); + $this->expectException(TagNotFoundException::class); $this->tagMapper->assignTags('1', 'testtype', [100]); } @@ -263,7 +264,7 @@ class SystemTagObjectMapperTest extends TestCase { public function testUnassignNonExistingTags(): void { - $this->expectException(\OCP\SystemTag\TagNotFoundException::class); + $this->expectException(TagNotFoundException::class); $this->tagMapper->unassignTags('1', 'testtype', [100]); } @@ -394,7 +395,7 @@ class SystemTagObjectMapperTest extends TestCase { public function testHaveTagNonExisting(): void { - $this->expectException(\OCP\SystemTag\TagNotFoundException::class); + $this->expectException(TagNotFoundException::class); $this->tagMapper->haveTag( ['1'], |