aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Comments/ManagerTest.php
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2024-09-15 22:32:31 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2024-09-15 22:32:31 +0200
commit49dd79eabb2b8902559a7a4e8f8fcad54f46b604 (patch)
tree2af18db46ba463368dc4461d7436fb69577923de /tests/lib/Comments/ManagerTest.php
parent4281ce6fa1bb8235426099d720734d2394bec203 (diff)
downloadnextcloud-server-49dd79eabb2b8902559a7a4e8f8fcad54f46b604.tar.gz
nextcloud-server-49dd79eabb2b8902559a7a4e8f8fcad54f46b604.zip
refactor: Add void return type to PHPUnit test methods
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests/lib/Comments/ManagerTest.php')
-rw-r--r--tests/lib/Comments/ManagerTest.php88
1 files changed, 44 insertions, 44 deletions
diff --git a/tests/lib/Comments/ManagerTest.php b/tests/lib/Comments/ManagerTest.php
index fda007c76a1..9a36182d393 100644
--- a/tests/lib/Comments/ManagerTest.php
+++ b/tests/lib/Comments/ManagerTest.php
@@ -97,7 +97,7 @@ class ManagerTest extends TestCase {
}
- public function testGetCommentNotFound() {
+ public function testGetCommentNotFound(): void {
$this->expectException(\OCP\Comments\NotFoundException::class);
$manager = $this->getManager();
@@ -105,14 +105,14 @@ class ManagerTest extends TestCase {
}
- public function testGetCommentNotFoundInvalidInput() {
+ public function testGetCommentNotFoundInvalidInput(): void {
$this->expectException(\InvalidArgumentException::class);
$manager = $this->getManager();
$manager->get('unexisting22');
}
- public function testGetComment() {
+ public function testGetComment(): void {
$manager = $this->getManager();
$creationDT = new \DateTime();
@@ -159,7 +159,7 @@ class ManagerTest extends TestCase {
}
- public function testGetTreeNotFound() {
+ public function testGetTreeNotFound(): void {
$this->expectException(\OCP\Comments\NotFoundException::class);
$manager = $this->getManager();
@@ -167,14 +167,14 @@ class ManagerTest extends TestCase {
}
- public function testGetTreeNotFoundInvalidIpnut() {
+ public function testGetTreeNotFoundInvalidIpnut(): void {
$this->expectException(\InvalidArgumentException::class);
$manager = $this->getManager();
$manager->getTree('unexisting22');
}
- public function testGetTree() {
+ public function testGetTree(): void {
$headId = $this->addDatabaseEntry(0, 0);
$this->addDatabaseEntry($headId, $headId, new \DateTime('-3 hours'));
@@ -200,7 +200,7 @@ class ManagerTest extends TestCase {
}
}
- public function testGetTreeNoReplies() {
+ public function testGetTreeNoReplies(): void {
$id = $this->addDatabaseEntry(0, 0);
$manager = $this->getManager();
@@ -219,7 +219,7 @@ class ManagerTest extends TestCase {
}
}
- public function testGetTreeWithLimitAndOffset() {
+ public function testGetTreeWithLimitAndOffset(): void {
$headId = $this->addDatabaseEntry(0, 0);
$this->addDatabaseEntry($headId, $headId, new \DateTime('-3 hours'));
@@ -249,7 +249,7 @@ class ManagerTest extends TestCase {
}
}
- public function testGetForObject() {
+ public function testGetForObject(): void {
$this->addDatabaseEntry(0, 0);
$manager = $this->getManager();
@@ -261,7 +261,7 @@ class ManagerTest extends TestCase {
$this->assertSame($comments[0]->getMessage(), 'nice one');
}
- public function testGetForObjectWithLimitAndOffset() {
+ public function testGetForObjectWithLimitAndOffset(): void {
$this->addDatabaseEntry(0, 0, new \DateTime('-6 hours'));
$this->addDatabaseEntry(0, 0, new \DateTime('-5 hours'));
$this->addDatabaseEntry(1, 1, new \DateTime('-4 hours'));
@@ -286,7 +286,7 @@ class ManagerTest extends TestCase {
} while (count($comments) > 0);
}
- public function testGetForObjectWithDateTimeConstraint() {
+ public function testGetForObjectWithDateTimeConstraint(): void {
$this->addDatabaseEntry(0, 0, new \DateTime('-6 hours'));
$this->addDatabaseEntry(0, 0, new \DateTime('-5 hours'));
$id1 = $this->addDatabaseEntry(0, 0, new \DateTime('-3 hours'));
@@ -300,7 +300,7 @@ class ManagerTest extends TestCase {
$this->assertSame($comments[1]->getId(), strval($id1));
}
- public function testGetForObjectWithLimitAndOffsetAndDateTimeConstraint() {
+ public function testGetForObjectWithLimitAndOffsetAndDateTimeConstraint(): void {
$this->addDatabaseEntry(0, 0, new \DateTime('-7 hours'));
$this->addDatabaseEntry(0, 0, new \DateTime('-6 hours'));
$this->addDatabaseEntry(1, 1, new \DateTime('-5 hours'));
@@ -326,7 +326,7 @@ class ManagerTest extends TestCase {
} while (count($comments) > 0);
}
- public function testGetNumberOfCommentsForObject() {
+ public function testGetNumberOfCommentsForObject(): void {
for ($i = 1; $i < 5; $i++) {
$this->addDatabaseEntry(0, 0);
}
@@ -340,7 +340,7 @@ class ManagerTest extends TestCase {
$this->assertSame($amount, 4);
}
- public function testGetNumberOfUnreadCommentsForFolder() {
+ public function testGetNumberOfUnreadCommentsForFolder(): void {
$folder = $this->createMock(Folder::class);
$fileIds = range(1111, 1114);
$children = array_map(function (int $id) {
@@ -391,7 +391,7 @@ class ManagerTest extends TestCase {
* @param $resultFrom
* @param $resultTo
*/
- public function testGetForObjectSince($lastKnown, $order, $limit, $resultFrom, $resultTo) {
+ public function testGetForObjectSince($lastKnown, $order, $limit, $resultFrom, $resultTo): void {
$ids = [];
$ids[] = $this->addDatabaseEntry(0, 0);
$ids[] = $this->addDatabaseEntry(0, 0);
@@ -445,14 +445,14 @@ class ManagerTest extends TestCase {
* @param string $oType
* @param string $oId
*/
- public function testCreateCommentInvalidArguments($aType, $aId, $oType, $oId) {
+ public function testCreateCommentInvalidArguments($aType, $aId, $oType, $oId): void {
$this->expectException(\InvalidArgumentException::class);
$manager = $this->getManager();
$manager->create($aType, $aId, $oType, $oId);
}
- public function testCreateComment() {
+ public function testCreateComment(): void {
$actorType = 'bot';
$actorId = 'bob';
$objectType = 'weather';
@@ -467,7 +467,7 @@ class ManagerTest extends TestCase {
}
- public function testDelete() {
+ public function testDelete(): void {
$this->expectException(\OCP\Comments\NotFoundException::class);
$manager = $this->getManager();
@@ -523,7 +523,7 @@ class ManagerTest extends TestCase {
];
}
- public function testSaveUpdate() {
+ public function testSaveUpdate(): void {
$manager = $this->getManager();
$comment = new Comment();
$comment
@@ -568,7 +568,7 @@ class ManagerTest extends TestCase {
}
- public function testSaveUpdateException() {
+ public function testSaveUpdateException(): void {
$this->expectException(\OCP\Comments\NotFoundException::class);
$manager = $this->getManager();
@@ -587,7 +587,7 @@ class ManagerTest extends TestCase {
}
- public function testSaveIncomplete() {
+ public function testSaveIncomplete(): void {
$this->expectException(\UnexpectedValueException::class);
$manager = $this->getManager();
@@ -596,7 +596,7 @@ class ManagerTest extends TestCase {
$manager->save($comment);
}
- public function testSaveAsChild() {
+ public function testSaveAsChild(): void {
$id = $this->addDatabaseEntry(0, 0);
$manager = $this->getManager();
@@ -635,14 +635,14 @@ class ManagerTest extends TestCase {
* @param string $type
* @param string $id
*/
- public function testDeleteReferencesOfActorInvalidInput($type, $id) {
+ public function testDeleteReferencesOfActorInvalidInput($type, $id): void {
$this->expectException(\InvalidArgumentException::class);
$manager = $this->getManager();
$manager->deleteReferencesOfActor($type, $id);
}
- public function testDeleteReferencesOfActor() {
+ public function testDeleteReferencesOfActor(): void {
$ids = [];
$ids[] = $this->addDatabaseEntry(0, 0);
$ids[] = $this->addDatabaseEntry(0, 0);
@@ -670,7 +670,7 @@ class ManagerTest extends TestCase {
$this->assertTrue($wasSuccessful);
}
- public function testDeleteReferencesOfActorWithUserManagement() {
+ public function testDeleteReferencesOfActorWithUserManagement(): void {
$user = \OC::$server->getUserManager()->createUser('xenia', 'NotAnEasyPassword123456+');
$this->assertTrue($user instanceof IUser);
@@ -704,14 +704,14 @@ class ManagerTest extends TestCase {
* @param string $type
* @param string $id
*/
- public function testDeleteCommentsAtObjectInvalidInput($type, $id) {
+ public function testDeleteCommentsAtObjectInvalidInput($type, $id): void {
$this->expectException(\InvalidArgumentException::class);
$manager = $this->getManager();
$manager->deleteCommentsAtObject($type, $id);
}
- public function testDeleteCommentsAtObject() {
+ public function testDeleteCommentsAtObject(): void {
$ids = [];
$ids[] = $this->addDatabaseEntry(0, 0);
$ids[] = $this->addDatabaseEntry(0, 0);
@@ -832,7 +832,7 @@ class ManagerTest extends TestCase {
$this->assertFalse($deleted);
}
- public function testSetMarkRead() {
+ public function testSetMarkRead(): void {
/** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$user->expects($this->any())
@@ -849,7 +849,7 @@ class ManagerTest extends TestCase {
$this->assertEquals($dateTimeGet->getTimestamp(), $dateTimeSet->getTimestamp());
}
- public function testSetMarkReadUpdate() {
+ public function testSetMarkReadUpdate(): void {
/** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$user->expects($this->any())
@@ -869,7 +869,7 @@ class ManagerTest extends TestCase {
$this->assertEquals($dateTimeGet, $dateTimeSet);
}
- public function testReadMarkDeleteUser() {
+ public function testReadMarkDeleteUser(): void {
/** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$user->expects($this->any())
@@ -887,7 +887,7 @@ class ManagerTest extends TestCase {
$this->assertNull($dateTimeGet);
}
- public function testReadMarkDeleteObject() {
+ public function testReadMarkDeleteObject(): void {
/** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$user->expects($this->any())
@@ -905,7 +905,7 @@ class ManagerTest extends TestCase {
$this->assertNull($dateTimeGet);
}
- public function testSendEvent() {
+ public function testSendEvent(): void {
$handler1 = $this->getMockBuilder(ICommentsEventHandler::class)->getMock();
$handler1->expects($this->exactly(4))
->method('handle');
@@ -940,7 +940,7 @@ class ManagerTest extends TestCase {
$manager->delete($comment->getId());
}
- public function testResolveDisplayName() {
+ public function testResolveDisplayName(): void {
$manager = $this->getManager();
$planetClosure = function ($name) {
@@ -959,7 +959,7 @@ class ManagerTest extends TestCase {
}
- public function testRegisterResolverDuplicate() {
+ public function testRegisterResolverDuplicate(): void {
$this->expectException(\OutOfBoundsException::class);
$manager = $this->getManager();
@@ -972,7 +972,7 @@ class ManagerTest extends TestCase {
}
- public function testRegisterResolverInvalidType() {
+ public function testRegisterResolverInvalidType(): void {
$this->expectException(\InvalidArgumentException::class);
$manager = $this->getManager();
@@ -984,7 +984,7 @@ class ManagerTest extends TestCase {
}
- public function testResolveDisplayNameUnregisteredType() {
+ public function testResolveDisplayNameUnregisteredType(): void {
$this->expectException(\OutOfBoundsException::class);
$manager = $this->getManager();
@@ -997,7 +997,7 @@ class ManagerTest extends TestCase {
$manager->resolveDisplayName('galaxy', 'sombrero');
}
- public function testResolveDisplayNameDirtyResolver() {
+ public function testResolveDisplayNameDirtyResolver(): void {
$manager = $this->getManager();
$planetClosure = function () {
@@ -1021,7 +1021,7 @@ class ManagerTest extends TestCase {
* @param array $reactionsExpected
* @return void
*/
- public function testReactionAddAndDelete(array $comments, array $reactionsExpected) {
+ public function testReactionAddAndDelete(array $comments, array $reactionsExpected): void {
$this->skipIfNotSupport4ByteUTF();
$manager = $this->getManager();
@@ -1080,7 +1080,7 @@ class ManagerTest extends TestCase {
];
}
- public function testResolveDisplayNameInvalidType() {
+ public function testResolveDisplayNameInvalidType(): void {
$this->expectException(\InvalidArgumentException::class);
$manager = $this->getManager();
@@ -1119,7 +1119,7 @@ class ManagerTest extends TestCase {
/**
* @dataProvider providerTestRetrieveAllReactions
*/
- public function testRetrieveAllReactions(array $comments, array $expected) {
+ public function testRetrieveAllReactions(array $comments, array $expected): void {
$this->skipIfNotSupport4ByteUTF();
$manager = $this->getManager();
@@ -2379,7 +2379,7 @@ class ManagerTest extends TestCase {
/**
* @dataProvider providerTestRetrieveAllReactionsWithSpecificReaction
*/
- public function testRetrieveAllReactionsWithSpecificReaction(array $comments, string $reaction, array $expected) {
+ public function testRetrieveAllReactionsWithSpecificReaction(array $comments, string $reaction, array $expected): void {
$this->skipIfNotSupport4ByteUTF();
$manager = $this->getManager();
@@ -2434,7 +2434,7 @@ class ManagerTest extends TestCase {
/**
* @dataProvider providerTestGetReactionComment
*/
- public function testGetReactionComment(array $comments, array $expected, bool $notFound) {
+ public function testGetReactionComment(array $comments, array $expected, bool $notFound): void {
$this->skipIfNotSupport4ByteUTF();
$manager = $this->getManager();
@@ -2503,7 +2503,7 @@ class ManagerTest extends TestCase {
/**
* @dataProvider providerTestReactionMessageSize
*/
- public function testReactionMessageSize($reactionString, $valid) {
+ public function testReactionMessageSize($reactionString, $valid): void {
$this->skipIfNotSupport4ByteUTF();
if (!$valid) {
$this->expectException(\UnexpectedValueException::class);
@@ -2534,7 +2534,7 @@ class ManagerTest extends TestCase {
/**
* @dataProvider providerTestReactionsSummarizeOrdered
*/
- public function testReactionsSummarizeOrdered(array $comments, array $expected, bool $isFullMatch) {
+ public function testReactionsSummarizeOrdered(array $comments, array $expected, bool $isFullMatch): void {
$this->skipIfNotSupport4ByteUTF();
$manager = $this->getManager();