aboutsummaryrefslogtreecommitdiffstats
path: root/apps/comments/tests/Unit/Controller/NotificationsTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/comments/tests/Unit/Controller/NotificationsTest.php')
-rw-r--r--apps/comments/tests/Unit/Controller/NotificationsTest.php40
1 files changed, 14 insertions, 26 deletions
diff --git a/apps/comments/tests/Unit/Controller/NotificationsTest.php b/apps/comments/tests/Unit/Controller/NotificationsTest.php
index 03eba79e6c8..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();
@@ -63,7 +55,7 @@ class NotificationsTest extends TestCase {
);
}
- public function testViewGuestRedirect() {
+ public function testViewGuestRedirect(): void {
$this->commentsManager->expects($this->never())
->method('get');
@@ -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'],
@@ -96,7 +84,7 @@ class NotificationsTest extends TestCase {
$this->assertSame('link-to-login', $response->getRedirectURL());
}
- public function testViewSuccess() {
+ public function testViewSuccess(): void {
$comment = $this->createMock(IComment::class);
$comment->expects($this->any())
->method('getObjectType')
@@ -146,11 +134,11 @@ class NotificationsTest extends TestCase {
$this->assertInstanceOf(RedirectResponse::class, $response);
}
- public function testViewInvalidComment() {
+ public function testViewInvalidComment(): void {
$this->commentsManager->expects($this->any())
->method('get')
->with('42')
- ->will($this->throwException(new NotFoundException()));
+ ->willThrowException(new NotFoundException());
$this->rootFolder->expects($this->never())
->method('getUserFolder');
@@ -174,7 +162,7 @@ class NotificationsTest extends TestCase {
$this->assertInstanceOf(NotFoundResponse::class, $response);
}
- public function testViewNoFile() {
+ public function testViewNoFile(): void {
$comment = $this->createMock(IComment::class);
$comment->expects($this->any())
->method('getObjectType')