aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Comments
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Comments')
-rw-r--r--tests/lib/Comments/CommentTest.php6
-rw-r--r--tests/lib/Comments/FakeFactory.php3
-rw-r--r--tests/lib/Comments/ManagerTest.php18
3 files changed, 15 insertions, 12 deletions
diff --git a/tests/lib/Comments/CommentTest.php b/tests/lib/Comments/CommentTest.php
index 988ffbe0e0b..9e28531a045 100644
--- a/tests/lib/Comments/CommentTest.php
+++ b/tests/lib/Comments/CommentTest.php
@@ -8,6 +8,8 @@ namespace Test\Comments;
use OC\Comments\Comment;
use OCP\Comments\IComment;
+use OCP\Comments\IllegalIDChangeException;
+use OCP\Comments\MessageTooLongException;
use Test\TestCase;
class CommentTest extends TestCase {
@@ -62,7 +64,7 @@ class CommentTest extends TestCase {
public function testSetIdIllegalInput(): void {
- $this->expectException(\OCP\Comments\IllegalIDChangeException::class);
+ $this->expectException(IllegalIDChangeException::class);
$comment = new Comment();
@@ -131,7 +133,7 @@ class CommentTest extends TestCase {
public function testSetUberlongMessage(): void {
- $this->expectException(\OCP\Comments\MessageTooLongException::class);
+ $this->expectException(MessageTooLongException::class);
$comment = new Comment();
$msg = str_pad('', IComment::MAX_MESSAGE_LENGTH + 1, 'x');
diff --git a/tests/lib/Comments/FakeFactory.php b/tests/lib/Comments/FakeFactory.php
index 04604ab2b44..19d8b58ae01 100644
--- a/tests/lib/Comments/FakeFactory.php
+++ b/tests/lib/Comments/FakeFactory.php
@@ -6,12 +6,13 @@
*/
namespace Test\Comments;
+use OCP\Comments\ICommentsManagerFactory;
use OCP\IServerContainer;
/**
* Class FakeFactory
*/
-class FakeFactory implements \OCP\Comments\ICommentsManagerFactory {
+class FakeFactory implements ICommentsManagerFactory {
public function __construct(IServerContainer $serverContainer) {
}
diff --git a/tests/lib/Comments/ManagerTest.php b/tests/lib/Comments/ManagerTest.php
index 86e70c56026..5d03bb06521 100644
--- a/tests/lib/Comments/ManagerTest.php
+++ b/tests/lib/Comments/ManagerTest.php
@@ -43,7 +43,7 @@ class ManagerTest extends TestCase {
protected function setUp(): void {
parent::setUp();
- $this->connection = \OC::$server->getDatabaseConnection();
+ $this->connection = Server::get(IDBConnection::class);
$this->rootFolder = $this->createMock(IRootFolder::class);
$sql = $this->connection->getDatabasePlatform()->getTruncateTableSQL('`*PREFIX*comments`');
@@ -96,7 +96,7 @@ class ManagerTest extends TestCase {
public function testGetCommentNotFound(): void {
- $this->expectException(\OCP\Comments\NotFoundException::class);
+ $this->expectException(NotFoundException::class);
$manager = $this->getManager();
$manager->get('22');
@@ -116,7 +116,7 @@ class ManagerTest extends TestCase {
$creationDT = new \DateTime('yesterday');
$latestChildDT = new \DateTime();
- $qb = \OCP\Server::get(IDBConnection::class)->getQueryBuilder();
+ $qb = Server::get(IDBConnection::class)->getQueryBuilder();
$qb
->insert('comments')
->values([
@@ -158,7 +158,7 @@ class ManagerTest extends TestCase {
public function testGetTreeNotFound(): void {
- $this->expectException(\OCP\Comments\NotFoundException::class);
+ $this->expectException(NotFoundException::class);
$manager = $this->getManager();
$manager->getTree('22');
@@ -450,7 +450,7 @@ class ManagerTest extends TestCase {
public function testDelete(): void {
- $this->expectException(\OCP\Comments\NotFoundException::class);
+ $this->expectException(NotFoundException::class);
$manager = $this->getManager();
@@ -564,7 +564,7 @@ class ManagerTest extends TestCase {
$manager->delete($comment->getId());
$comment->setMessage('very beautiful, I am really so much impressed!');
- $this->expectException(\OCP\Comments\NotFoundException::class);
+ $this->expectException(NotFoundException::class);
$manager->save($comment);
}
@@ -652,10 +652,10 @@ class ManagerTest extends TestCase {
}
public function testDeleteReferencesOfActorWithUserManagement(): void {
- $user = \OCP\Server::get(IUserManager::class)->createUser('xenia', 'NotAnEasyPassword123456+');
+ $user = Server::get(IUserManager::class)->createUser('xenia', 'NotAnEasyPassword123456+');
$this->assertInstanceOf(IUser::class, $user);
- $manager = \OCP\Server::get(ICommentsManager::class);
+ $manager = Server::get(ICommentsManager::class);
$comment = $manager->create('users', $user->getUID(), 'files', 'file64');
$comment
->setMessage('Most important comment I ever left on the Internet.')
@@ -2425,7 +2425,7 @@ class ManagerTest extends TestCase {
$expected = array_combine($keys, $expected);
if ($notFound) {
- $this->expectException(\OCP\Comments\NotFoundException::class);
+ $this->expectException(NotFoundException::class);
}
$comment = $processedComments[$expected['message'] . '#' . $expected['actorId']];
$actual = $manager->getReactionComment((int)$comment->getParentId(), $comment->getActorType(), $comment->getActorId(), $comment->getMessage());