1717use OCP \Comments \Events \CommentDeletedEvent ;
1818use OCP \Comments \Events \CommentUpdatedEvent ;
1919use OCP \Comments \IComment ;
20+ use OCP \EventDispatcher \IEventDispatcher ;
21+ use PHPUnit \Framework \Attributes \DataProvider ;
2022use PHPUnit \Framework \MockObject \MockObject ;
2123use Test \TestCase ;
2224
@@ -25,23 +27,22 @@ class EventHandlerTest extends TestCase {
2527 protected NotificationListener &MockObject $ notificationListener ;
2628 protected CommentsEventListener $ eventHandler ;
2729
30+ #[\Override]
2831 protected function setUp (): void {
2932 parent ::setUp ();
3033
3134 $ this ->activityListener = $ this ->createMock (ActivityListener::class);
3235 $ this ->notificationListener = $ this ->createMock (NotificationListener::class);
3336
34- $ this ->eventHandler = new CommentsEventListener ($ this ->activityListener , $ this ->notificationListener );
37+ $ this ->eventHandler = new CommentsEventListener ($ this ->activityListener , $ this ->notificationListener , $ this -> createMock (IEventDispatcher::class) );
3538 }
3639
3740 public function testNotFiles (): void {
38- /** @var IComment|MockObject $comment */
3941 $ comment = $ this ->createMock (IComment::class);
4042 $ comment ->expects ($ this ->once ())
4143 ->method ('getObjectType ' )
4244 ->willReturn ('smiles ' );
4345
44- /** @var CommentsEvent|MockObject $event */
4546 $ event = $ this ->createMock (CommentsEvent::class);
4647 $ event ->expects ($ this ->once ())
4748 ->method ('getComment ' )
@@ -61,9 +62,8 @@ public static function handledProvider(): array {
6162 ];
6263 }
6364
64- #[\ PHPUnit \ Framework \ Attributes \ DataProvider(methodName: 'handledProvider ' )]
65+ #[DataProvider(methodName: 'handledProvider ' )]
6566 public function testHandled (string $ eventType ): void {
66- /** @var IComment|MockObject $comment */
6767 $ comment = $ this ->createMock (IComment::class);
6868 $ comment ->expects ($ this ->once ())
6969 ->method ('getObjectType ' )
0 commit comments