diff options
Diffstat (limited to 'apps/comments/tests')
7 files changed, 149 insertions, 208 deletions
diff --git a/apps/comments/tests/Unit/Activity/ListenerTest.php b/apps/comments/tests/Unit/Activity/ListenerTest.php index 70dec741978..675a28a16b1 100644 --- a/apps/comments/tests/Unit/Activity/ListenerTest.php +++ b/apps/comments/tests/Unit/Activity/ListenerTest.php @@ -1,4 +1,7 @@ <?php + +declare(strict_types=1); + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -20,30 +23,17 @@ use OCP\Files\Node; use OCP\IUser; use OCP\IUserSession; use OCP\Share\IShareHelper; +use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class ListenerTest extends TestCase { - - /** @var Listener */ - protected $listener; - - /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */ - protected $activityManager; - - /** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */ - protected $session; - - /** @var IAppManager|\PHPUnit\Framework\MockObject\MockObject */ - protected $appManager; - - /** @var IMountProviderCollection|\PHPUnit\Framework\MockObject\MockObject */ - protected $mountProviderCollection; - - /** @var IRootFolder|\PHPUnit\Framework\MockObject\MockObject */ - protected $rootFolder; - - /** @var IShareHelper|\PHPUnit\Framework\MockObject\MockObject */ - protected $shareHelper; + protected IManager&MockObject $activityManager; + protected IUserSession&MockObject $session; + protected IAppManager&MockObject $appManager; + protected IMountProviderCollection&MockObject $mountProviderCollection; + protected IRootFolder&MockObject $rootFolder; + protected IShareHelper&MockObject $shareHelper; + protected Listener $listener; protected function setUp(): void { parent::setUp(); @@ -76,7 +66,7 @@ class ListenerTest extends TestCase { ->method('getObjectType') ->willReturn('files'); - /** @var CommentsEvent|\PHPUnit\Framework\MockObject\MockObject $event */ + /** @var CommentsEvent|MockObject $event */ $event = $this->createMock(CommentsEvent::class); $event->expects($this->any()) ->method('getComment') @@ -85,13 +75,13 @@ class ListenerTest extends TestCase { ->method('getEvent') ->willReturn(CommentsEvent::EVENT_ADD); - /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $ownerUser */ + /** @var IUser|MockObject $ownerUser */ $ownerUser = $this->createMock(IUser::class); $ownerUser->expects($this->any()) ->method('getUID') ->willReturn('937393'); - /** @var \PHPUnit\Framework\MockObject\MockObject $mount */ + /** @var MockObject $mount */ $mount = $this->createMock(ICachedMountFileInfo::class); $mount->expects($this->any()) ->method('getUser') @@ -133,7 +123,7 @@ class ListenerTest extends TestCase { ->method('getUser') ->willReturn($ownerUser); - /** @var \PHPUnit\Framework\MockObject\MockObject $activity */ + /** @var MockObject $activity */ $activity = $this->createMock(IEvent::class); $activity->expects($this->exactly(count($al['users']))) ->method('setAffectedUser'); diff --git a/apps/comments/tests/Unit/AppInfo/ApplicationTest.php b/apps/comments/tests/Unit/AppInfo/ApplicationTest.php index abd5b188d44..119db5333b5 100644 --- a/apps/comments/tests/Unit/AppInfo/ApplicationTest.php +++ b/apps/comments/tests/Unit/AppInfo/ApplicationTest.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -7,7 +9,12 @@ */ namespace OCA\Comments\Tests\Unit\AppInfo; +use OCA\Comments\Activity\Filter; +use OCA\Comments\Activity\Listener; +use OCA\Comments\Activity\Provider; +use OCA\Comments\Activity\Setting; use OCA\Comments\AppInfo\Application; +use OCA\Comments\Controller\NotificationsController; use OCA\Comments\Notification\Notifier; use OCP\IUserManager; use OCP\IUserSession; @@ -38,12 +45,12 @@ class ApplicationTest extends TestCase { $c = $app->getContainer(); $services = [ - 'OCA\Comments\Controller\NotificationsController', - 'OCA\Comments\Activity\Filter', - 'OCA\Comments\Activity\Listener', - 'OCA\Comments\Activity\Provider', - 'OCA\Comments\Activity\Setting', - 'OCA\Comments\Notification\Listener', + NotificationsController::class, + Filter::class, + Listener::class, + Provider::class, + Setting::class, + \OCA\Comments\Notification\Listener::class, Notifier::class, ]; diff --git a/apps/comments/tests/Unit/Collaboration/CommentersSorterTest.php b/apps/comments/tests/Unit/Collaboration/CommentersSorterTest.php index c0de0016c31..4d3392a562d 100644 --- a/apps/comments/tests/Unit/Collaboration/CommentersSorterTest.php +++ b/apps/comments/tests/Unit/Collaboration/CommentersSorterTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -8,13 +9,12 @@ namespace OCA\Comments\Tests\Unit\Collaboration; use OCA\Comments\Collaboration\CommentersSorter; use OCP\Comments\IComment; use OCP\Comments\ICommentsManager; +use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class CommentersSorterTest extends TestCase { - /** @var ICommentsManager|\PHPUnit\Framework\MockObject\MockObject */ - protected $commentsManager; - /** @var CommentersSorter */ - protected $sorter; + protected ICommentsManager&MockObject $commentsManager; + protected CommentersSorter $sorter; protected function setUp(): void { parent::setUp(); @@ -25,9 +25,9 @@ class CommentersSorterTest extends TestCase { } /** - * @dataProvider sortDataProvider * @param $data */ + #[\PHPUnit\Framework\Attributes\DataProvider('sortDataProvider')] public function testSort($data): void { $commentMocks = []; foreach ($data['actors'] as $actorType => $actors) { @@ -55,38 +55,36 @@ class CommentersSorterTest extends TestCase { $this->assertEquals($data['expected'], $workArray); } - public function sortDataProvider() { + public static function sortDataProvider(): array { return [[ [ #1 – sort properly and otherwise keep existing order 'actors' => ['users' => ['celia' => 3, 'darius' => 7, 'faruk' => 5, 'gail' => 5], 'bots' => ['r2-d2' => 8]], 'input' => [ - 'users' => - [ - ['value' => ['shareWith' => 'alice']], - ['value' => ['shareWith' => 'bob']], - ['value' => ['shareWith' => 'celia']], - ['value' => ['shareWith' => 'darius']], - ['value' => ['shareWith' => 'elena']], - ['value' => ['shareWith' => 'faruk']], - ['value' => ['shareWith' => 'gail']], - ], + 'users' => [ + ['value' => ['shareWith' => 'alice']], + ['value' => ['shareWith' => 'bob']], + ['value' => ['shareWith' => 'celia']], + ['value' => ['shareWith' => 'darius']], + ['value' => ['shareWith' => 'elena']], + ['value' => ['shareWith' => 'faruk']], + ['value' => ['shareWith' => 'gail']], + ], 'bots' => [ ['value' => ['shareWith' => 'c-3po']], ['value' => ['shareWith' => 'r2-d2']], ] ], 'expected' => [ - 'users' => - [ - ['value' => ['shareWith' => 'darius']], - ['value' => ['shareWith' => 'faruk']], - ['value' => ['shareWith' => 'gail']], - ['value' => ['shareWith' => 'celia']], - ['value' => ['shareWith' => 'alice']], - ['value' => ['shareWith' => 'bob']], - ['value' => ['shareWith' => 'elena']], - ], + 'users' => [ + ['value' => ['shareWith' => 'darius']], + ['value' => ['shareWith' => 'faruk']], + ['value' => ['shareWith' => 'gail']], + ['value' => ['shareWith' => 'celia']], + ['value' => ['shareWith' => 'alice']], + ['value' => ['shareWith' => 'bob']], + ['value' => ['shareWith' => 'elena']], + ], 'bots' => [ ['value' => ['shareWith' => 'r2-d2']], ['value' => ['shareWith' => 'c-3po']], @@ -97,32 +95,30 @@ class CommentersSorterTest extends TestCase { #2 – no commentors, input equals output 'actors' => [], 'input' => [ - 'users' => - [ - ['value' => ['shareWith' => 'alice']], - ['value' => ['shareWith' => 'bob']], - ['value' => ['shareWith' => 'celia']], - ['value' => ['shareWith' => 'darius']], - ['value' => ['shareWith' => 'elena']], - ['value' => ['shareWith' => 'faruk']], - ['value' => ['shareWith' => 'gail']], - ], + 'users' => [ + ['value' => ['shareWith' => 'alice']], + ['value' => ['shareWith' => 'bob']], + ['value' => ['shareWith' => 'celia']], + ['value' => ['shareWith' => 'darius']], + ['value' => ['shareWith' => 'elena']], + ['value' => ['shareWith' => 'faruk']], + ['value' => ['shareWith' => 'gail']], + ], 'bots' => [ ['value' => ['shareWith' => 'c-3po']], ['value' => ['shareWith' => 'r2-d2']], ] ], 'expected' => [ - 'users' => - [ - ['value' => ['shareWith' => 'alice']], - ['value' => ['shareWith' => 'bob']], - ['value' => ['shareWith' => 'celia']], - ['value' => ['shareWith' => 'darius']], - ['value' => ['shareWith' => 'elena']], - ['value' => ['shareWith' => 'faruk']], - ['value' => ['shareWith' => 'gail']], - ], + 'users' => [ + ['value' => ['shareWith' => 'alice']], + ['value' => ['shareWith' => 'bob']], + ['value' => ['shareWith' => 'celia']], + ['value' => ['shareWith' => 'darius']], + ['value' => ['shareWith' => 'elena']], + ['value' => ['shareWith' => 'faruk']], + ['value' => ['shareWith' => 'gail']], + ], 'bots' => [ ['value' => ['shareWith' => 'c-3po']], ['value' => ['shareWith' => 'r2-d2']], diff --git a/apps/comments/tests/Unit/Controller/NotificationsTest.php b/apps/comments/tests/Unit/Controller/NotificationsTest.php index ccd808895c8..04490ca63e8 100644 --- a/apps/comments/tests/Unit/Controller/NotificationsTest.php +++ b/apps/comments/tests/Unit/Controller/NotificationsTest.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -22,26 +24,16 @@ use OCP\IUser; use OCP\IUserSession; use OCP\Notification\IManager; use OCP\Notification\INotification; +use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class NotificationsTest extends TestCase { - /** @var NotificationsController */ - protected $notificationsController; - - /** @var ICommentsManager|\PHPUnit\Framework\MockObject\MockObject */ - protected $commentsManager; - - /** @var IRootFolder|\PHPUnit\Framework\MockObject\MockObject */ - protected $rootFolder; - - /** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */ - protected $session; - - /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */ - protected $notificationManager; - - /** @var IURLGenerator|\PHPUnit\Framework\MockObject\MockObject */ - protected $urlGenerator; + protected ICommentsManager&MockObject $commentsManager; + protected IRootFolder&MockObject $rootFolder; + protected IUserSession&MockObject $session; + protected IManager&MockObject $notificationManager; + protected IURLGenerator&MockObject $urlGenerator; + protected NotificationsController $notificationsController; protected function setUp(): void { parent::setUp(); @@ -81,10 +73,6 @@ class NotificationsTest extends TestCase { $this->urlGenerator->expects($this->exactly(2)) ->method('linkToRoute') - ->withConsecutive( - ['comments.Notifications.view', ['id' => '42']], - ['core.login.showLoginForm', ['redirect_url' => 'link-to-comment']] - ) ->willReturnMap([ ['comments.Notifications.view', ['id' => '42'], 'link-to-comment'], ['core.login.showLoginForm', ['redirect_url' => 'link-to-comment'], 'link-to-login'], @@ -150,7 +138,7 @@ class NotificationsTest extends TestCase { $this->commentsManager->expects($this->any()) ->method('get') ->with('42') - ->will($this->throwException(new NotFoundException())); + ->willThrowException(new NotFoundException()); $this->rootFolder->expects($this->never()) ->method('getUserFolder'); diff --git a/apps/comments/tests/Unit/EventHandlerTest.php b/apps/comments/tests/Unit/EventHandlerTest.php index 83ce1af57da..9d26f828d70 100644 --- a/apps/comments/tests/Unit/EventHandlerTest.php +++ b/apps/comments/tests/Unit/EventHandlerTest.php @@ -1,4 +1,7 @@ <?php + +declare(strict_types=1); + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -10,43 +13,32 @@ use OCA\Comments\Listener\CommentsEventListener; use OCA\Comments\Notification\Listener as NotificationListener; use OCP\Comments\CommentsEvent; use OCP\Comments\IComment; +use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class EventHandlerTest extends TestCase { - /** @var CommentsEventListener */ - protected $eventHandler; - - /** @var ActivityListener|\PHPUnit\Framework\MockObject\MockObject */ - protected $activityListener; - - /** @var NotificationListener|\PHPUnit\Framework\MockObject\MockObject */ - protected $notificationListener; + protected ActivityListener&MockObject $activityListener; + protected NotificationListener&MockObject $notificationListener; + protected CommentsEventListener $eventHandler; protected function setUp(): void { parent::setUp(); - $this->activityListener = $this->getMockBuilder(ActivityListener::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->notificationListener = $this->getMockBuilder(NotificationListener::class) - ->disableOriginalConstructor() - ->getMock(); + $this->activityListener = $this->createMock(ActivityListener::class); + $this->notificationListener = $this->createMock(NotificationListener::class); $this->eventHandler = new CommentsEventListener($this->activityListener, $this->notificationListener); } public function testNotFiles(): void { - /** @var IComment|\PHPUnit\Framework\MockObject\MockObject $comment */ - $comment = $this->getMockBuilder(IComment::class)->getMock(); + /** @var IComment|MockObject $comment */ + $comment = $this->createMock(IComment::class); $comment->expects($this->once()) ->method('getObjectType') ->willReturn('smiles'); - /** @var CommentsEvent|\PHPUnit\Framework\MockObject\MockObject $event */ - $event = $this->getMockBuilder(CommentsEvent::class) - ->disableOriginalConstructor() - ->getMock(); + /** @var CommentsEvent|MockObject $event */ + $event = $this->createMock(CommentsEvent::class); $event->expects($this->once()) ->method('getComment') ->willReturn($comment); @@ -56,7 +48,7 @@ class EventHandlerTest extends TestCase { $this->eventHandler->handle($event); } - public function handledProvider() { + public static function handledProvider(): array { return [ [CommentsEvent::EVENT_DELETE], [CommentsEvent::EVENT_UPDATE], @@ -65,21 +57,16 @@ class EventHandlerTest extends TestCase { ]; } - /** - * @dataProvider handledProvider - * @param string $eventType - */ - public function testHandled($eventType): void { - /** @var IComment|\PHPUnit\Framework\MockObject\MockObject $comment */ - $comment = $this->getMockBuilder(IComment::class)->getMock(); + #[\PHPUnit\Framework\Attributes\DataProvider('handledProvider')] + public function testHandled(string $eventType): void { + /** @var IComment|MockObject $comment */ + $comment = $this->createMock(IComment::class); $comment->expects($this->once()) ->method('getObjectType') ->willReturn('files'); - /** @var CommentsEvent|\PHPUnit\Framework\MockObject\MockObject $event */ - $event = $this->getMockBuilder(CommentsEvent::class) - ->disableOriginalConstructor() - ->getMock(); + /** @var CommentsEvent|MockObject $event */ + $event = $this->createMock(CommentsEvent::class); $event->expects($this->atLeastOnce()) ->method('getComment') ->willReturn($comment); diff --git a/apps/comments/tests/Unit/Notification/ListenerTest.php b/apps/comments/tests/Unit/Notification/ListenerTest.php index a9175b7e203..356a26f23cd 100644 --- a/apps/comments/tests/Unit/Notification/ListenerTest.php +++ b/apps/comments/tests/Unit/Notification/ListenerTest.php @@ -14,25 +14,19 @@ use OCP\IURLGenerator; use OCP\IUserManager; use OCP\Notification\IManager; use OCP\Notification\INotification; +use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class ListenerTest extends TestCase { - /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */ - protected $notificationManager; - - /** @var IUserManager|\PHPUnit\Framework\MockObject\MockObject */ - protected $userManager; - - /** @var IURLGenerator|\PHPUnit\Framework\MockObject\MockObject */ - protected $urlGenerator; - - /** @var Listener */ - protected $listener; + protected IManager&MockObject $notificationManager; + protected IUserManager&MockObject $userManager; + protected IURLGenerator&MockObject $urlGenerator; + protected Listener $listener; protected function setUp(): void { parent::setUp(); - $this->notificationManager = $this->createMock(\OCP\Notification\IManager::class); + $this->notificationManager = $this->createMock(IManager::class); $this->userManager = $this->createMock(IUserManager::class); $this->listener = new Listener( @@ -41,7 +35,7 @@ class ListenerTest extends TestCase { ); } - public function eventProvider() { + public static function eventProvider(): array { return [ [CommentsEvent::EVENT_ADD, 'notify'], [CommentsEvent::EVENT_UPDATE, 'notify'], @@ -51,13 +45,13 @@ class ListenerTest extends TestCase { } /** - * @dataProvider eventProvider * @param string $eventType * @param string $notificationMethod */ + #[\PHPUnit\Framework\Attributes\DataProvider('eventProvider')] public function testEvaluate($eventType, $notificationMethod): void { - /** @var IComment|\PHPUnit\Framework\MockObject\MockObject $comment */ - $comment = $this->getMockBuilder(IComment::class)->getMock(); + /** @var IComment|MockObject $comment */ + $comment = $this->createMock(IComment::class); $comment->expects($this->any()) ->method('getObjectType') ->willReturn('files'); @@ -78,10 +72,8 @@ class ListenerTest extends TestCase { ->method('getId') ->willReturn('1234'); - /** @var CommentsEvent|\PHPUnit\Framework\MockObject\MockObject $event */ - $event = $this->getMockBuilder(CommentsEvent::class) - ->disableOriginalConstructor() - ->getMock(); + /** @var CommentsEvent|MockObject $event */ + $event = $this->createMock(CommentsEvent::class); $event->expects($this->once()) ->method('getComment') ->willReturn($comment); @@ -89,8 +81,8 @@ class ListenerTest extends TestCase { ->method(('getEvent')) ->willReturn($eventType); - /** @var INotification|\PHPUnit\Framework\MockObject\MockObject $notification */ - $notification = $this->getMockBuilder(INotification::class)->getMock(); + /** @var INotification|MockObject $notification */ + $notification = $this->createMock(INotification::class); $notification->expects($this->any()) ->method($this->anything()) ->willReturn($notification); @@ -106,26 +98,22 @@ class ListenerTest extends TestCase { $this->userManager->expects($this->exactly(6)) ->method('userExists') - ->withConsecutive( - ['foobar'], - ['barfoo'], - ['foo@bar.com'], - ['bar@foo.org@foobar.io'], - ['23452-4333-54353-2342'], - ['yolo'] - ) - ->willReturn(true); + ->willReturnMap([ + ['foobar', true], + ['barfoo', true], + ['foo@bar.com', true], + ['bar@foo.org@foobar.io', true], + ['23452-4333-54353-2342', true], + ['yolo', true] + ]); $this->listener->evaluate($event); } - /** - * @dataProvider eventProvider - * @param string $eventType - */ - public function testEvaluateNoMentions($eventType): void { - /** @var IComment|\PHPUnit\Framework\MockObject\MockObject $comment */ - $comment = $this->getMockBuilder(IComment::class)->getMock(); + #[\PHPUnit\Framework\Attributes\DataProvider('eventProvider')] + public function testEvaluateNoMentions(string $eventType): void { + /** @var IComment|MockObject $comment */ + $comment = $this->createMock(IComment::class); $comment->expects($this->any()) ->method('getObjectType') ->willReturn('files'); @@ -136,10 +124,8 @@ class ListenerTest extends TestCase { ->method('getMentions') ->willReturn([]); - /** @var CommentsEvent|\PHPUnit\Framework\MockObject\MockObject $event */ - $event = $this->getMockBuilder(CommentsEvent::class) - ->disableOriginalConstructor() - ->getMock(); + /** @var CommentsEvent|MockObject $event */ + $event = $this->createMock(CommentsEvent::class); $event->expects($this->once()) ->method('getComment') ->willReturn($comment); @@ -161,8 +147,8 @@ class ListenerTest extends TestCase { } public function testEvaluateUserDoesNotExist(): void { - /** @var IComment|\PHPUnit\Framework\MockObject\MockObject $comment */ - $comment = $this->getMockBuilder(IComment::class)->getMock(); + /** @var IComment|MockObject $comment */ + $comment = $this->createMock(IComment::class); $comment->expects($this->any()) ->method('getObjectType') ->willReturn('files'); @@ -176,10 +162,8 @@ class ListenerTest extends TestCase { ->method('getId') ->willReturn('1234'); - /** @var CommentsEvent|\PHPUnit\Framework\MockObject\MockObject $event */ - $event = $this->getMockBuilder(CommentsEvent::class) - ->disableOriginalConstructor() - ->getMock(); + /** @var CommentsEvent|MockObject $event */ + $event = $this->createMock(CommentsEvent::class); $event->expects($this->once()) ->method('getComment') ->willReturn($comment); @@ -187,8 +171,8 @@ class ListenerTest extends TestCase { ->method(('getEvent')) ->willReturn(CommentsEvent::EVENT_ADD); - /** @var INotification|\PHPUnit\Framework\MockObject\MockObject $notification */ - $notification = $this->getMockBuilder(INotification::class)->getMock(); + /** @var INotification|MockObject $notification */ + $notification = $this->createMock(INotification::class); $notification->expects($this->any()) ->method($this->anything()) ->willReturn($notification); @@ -203,9 +187,7 @@ class ListenerTest extends TestCase { $this->userManager->expects($this->once()) ->method('userExists') - ->withConsecutive( - ['foobar'] - ) + ->with('foobar') ->willReturn(false); $this->listener->evaluate($event); diff --git a/apps/comments/tests/Unit/Notification/NotifierTest.php b/apps/comments/tests/Unit/Notification/NotifierTest.php index 87b87e646af..37cad0b43df 100644 --- a/apps/comments/tests/Unit/Notification/NotifierTest.php +++ b/apps/comments/tests/Unit/Notification/NotifierTest.php @@ -1,4 +1,7 @@ <?php + +declare(strict_types=1); + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -23,26 +26,16 @@ use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class NotifierTest extends TestCase { - /** @var Notifier */ - protected $notifier; - /** @var IFactory|MockObject */ - protected $l10nFactory; - /** @var IL10N|MockObject */ - protected $l; - /** @var IRootFolder|MockObject */ - protected $folder; - /** @var ICommentsManager|MockObject */ - protected $commentsManager; - /** @var IURLGenerator|MockObject */ - protected $url; - /** @var IUserManager|MockObject */ - protected $userManager; - /** @var INotification|MockObject */ - protected $notification; - /** @var IComment|MockObject */ - protected $comment; - /** @var string */ - protected $lc = 'tlh_KX'; + protected IFactory&MockObject $l10nFactory; + protected IL10N&MockObject $l; + protected IRootFolder&MockObject $folder; + protected ICommentsManager&MockObject $commentsManager; + protected IURLGenerator&MockObject $url; + protected IUserManager&MockObject $userManager; + protected INotification&MockObject $notification; + protected IComment&MockObject $comment; + protected Notifier $notifier; + protected string $lc = 'tlh_KX'; protected function setUp(): void { parent::setUp(); @@ -75,9 +68,8 @@ class NotifierTest extends TestCase { public function testPrepareSuccess(): void { $fileName = 'Gre\'thor.odp'; $displayName = 'Huraga'; - $message = '@Huraga mentioned you in a comment on "Gre\'thor.odp"'; - /** @var Node|MockObject $node */ + /** @var Node&MockObject $node */ $node = $this->createMock(Node::class); $node ->expects($this->atLeastOnce()) @@ -192,7 +184,6 @@ class NotifierTest extends TestCase { public function testPrepareSuccessDeletedUser(): void { $fileName = 'Gre\'thor.odp'; - $message = 'You were mentioned on "Gre\'thor.odp", in a comment by an account that has since been deleted'; /** @var Node|MockObject $node */ $node = $this->createMock(Node::class); |