diff --git a/apps/comments/tests/Unit/Activity/ListenerTest.php b/apps/comments/tests/Unit/Activity/ListenerTest.php
index 358fd1b3af2..fbb1a3ef152 100644
--- a/apps/comments/tests/Unit/Activity/ListenerTest.php
+++ b/apps/comments/tests/Unit/Activity/ListenerTest.php
@@ -35,6 +35,7 @@ class ListenerTest extends TestCase {
protected IShareHelper&MockObject $shareHelper;
protected Listener $listener;
+ #[\Override]
protected function setUp(): void {
parent::setUp();
diff --git a/apps/comments/tests/Unit/AppInfo/ApplicationTest.php b/apps/comments/tests/Unit/AppInfo/ApplicationTest.php
index 696057681ac..a2af64b6cfb 100644
--- a/apps/comments/tests/Unit/AppInfo/ApplicationTest.php
+++ b/apps/comments/tests/Unit/AppInfo/ApplicationTest.php
@@ -28,12 +28,14 @@ use Test\TestCase;
*/
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class ApplicationTest extends TestCase {
+ #[\Override]
protected function setUp(): void {
parent::setUp();
Server::get(IUserManager::class)->createUser('dummy', '456');
Server::get(IUserSession::class)->setUser(Server::get(IUserManager::class)->get('dummy'));
}
+ #[\Override]
protected function tearDown(): void {
Server::get(IUserManager::class)->get('dummy')->delete();
parent::tearDown();
diff --git a/apps/comments/tests/Unit/Collaboration/CommentersSorterTest.php b/apps/comments/tests/Unit/Collaboration/CommentersSorterTest.php
index 0abc7f88c6a..c83bd283a08 100644
--- a/apps/comments/tests/Unit/Collaboration/CommentersSorterTest.php
+++ b/apps/comments/tests/Unit/Collaboration/CommentersSorterTest.php
@@ -16,6 +16,7 @@ class CommentersSorterTest extends TestCase {
protected ICommentsManager&MockObject $commentsManager;
protected CommentersSorter $sorter;
+ #[\Override]
protected function setUp(): void {
parent::setUp();
diff --git a/apps/comments/tests/Unit/Controller/NotificationsTest.php b/apps/comments/tests/Unit/Controller/NotificationsTest.php
index 5b1180f662b..0150884f1cc 100644
--- a/apps/comments/tests/Unit/Controller/NotificationsTest.php
+++ b/apps/comments/tests/Unit/Controller/NotificationsTest.php
@@ -35,6 +35,7 @@ class NotificationsTest extends TestCase {
protected IURLGenerator&MockObject $urlGenerator;
protected NotificationsController $notificationsController;
+ #[\Override]
protected function setUp(): void {
parent::setUp();
diff --git a/apps/comments/tests/Unit/EventHandlerTest.php b/apps/comments/tests/Unit/EventHandlerTest.php
index 666b1623d97..ff7496c7e7d 100644
--- a/apps/comments/tests/Unit/EventHandlerTest.php
+++ b/apps/comments/tests/Unit/EventHandlerTest.php
@@ -17,6 +17,8 @@ use OCP\Comments\Events\CommentAddedEvent;
use OCP\Comments\Events\CommentDeletedEvent;
use OCP\Comments\Events\CommentUpdatedEvent;
use OCP\Comments\IComment;
+use OCP\EventDispatcher\IEventDispatcher;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
@@ -25,23 +27,22 @@ class EventHandlerTest extends TestCase {
protected NotificationListener&MockObject $notificationListener;
protected CommentsEventListener $eventHandler;
+ #[\Override]
protected function setUp(): void {
parent::setUp();
$this->activityListener = $this->createMock(ActivityListener::class);
$this->notificationListener = $this->createMock(NotificationListener::class);
- $this->eventHandler = new CommentsEventListener($this->activityListener, $this->notificationListener);
+ $this->eventHandler = new CommentsEventListener($this->activityListener, $this->notificationListener, $this->createMock(IEventDispatcher::class));
}
public function testNotFiles(): void {
- /** @var IComment|MockObject $comment */
$comment = $this->createMock(IComment::class);
$comment->expects($this->once())
->method('getObjectType')
->willReturn('smiles');
- /** @var CommentsEvent|MockObject $event */
$event = $this->createMock(CommentsEvent::class);
$event->expects($this->once())
->method('getComment')
@@ -61,9 +62,8 @@ class EventHandlerTest extends TestCase {
];
}
- #[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'handledProvider')]
+ #[DataProvider(methodName: 'handledProvider')]
public function testHandled(string $eventType): void {
- /** @var IComment|MockObject $comment */
$comment = $this->createMock(IComment::class);
$comment->expects($this->once())
->method('getObjectType')
diff --git a/apps/comments/tests/Unit/Notification/ListenerTest.php b/apps/comments/tests/Unit/Notification/ListenerTest.php
index a84e86ef528..eac83c74855 100644
--- a/apps/comments/tests/Unit/Notification/ListenerTest.php
+++ b/apps/comments/tests/Unit/Notification/ListenerTest.php
@@ -26,6 +26,7 @@ class ListenerTest extends TestCase {
protected IURLGenerator&MockObject $urlGenerator;
protected Listener $listener;
+ #[\Override]
protected function setUp(): void {
parent::setUp();
diff --git a/apps/comments/tests/Unit/Notification/NotifierTest.php b/apps/comments/tests/Unit/Notification/NotifierTest.php
index cd2d1be1408..03ebc87c950 100644
--- a/apps/comments/tests/Unit/Notification/NotifierTest.php
+++ b/apps/comments/tests/Unit/Notification/NotifierTest.php
@@ -37,6 +37,7 @@ class NotifierTest extends TestCase {
protected Notifier $notifier;
protected string $lc = 'tlh_KX';
+ #[\Override]
protected function setUp(): void {
parent::setUp();
diff --git a/psalm.xml b/psalm.xml
index 9b029ce31d4..dbe8723dcf8 100644
--- a/psalm.xml
+++ b/psalm.xml
@@ -64,7 +64,32 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+