aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php')
-rw-r--r--apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php48
1 files changed, 16 insertions, 32 deletions
diff --git a/apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php b/apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php
index 41f104fe20b..631b6a0f51c 100644
--- a/apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php
+++ b/apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php
@@ -1,25 +1,8 @@
<?php
+
/**
- * @copyright Copyright (c) 2016 Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Files_Sharing\Tests\Middleware;
@@ -29,6 +12,7 @@ use OCA\Files_Sharing\Middleware\ShareInfoMiddleware;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\JSONResponse;
+use OCP\AppFramework\Http\Response;
use OCP\Share\IManager as ShareManager;
use Test\TestCase;
@@ -47,14 +31,14 @@ class ShareInfoMiddlewareTest extends TestCase {
$this->middleware = new ShareInfoMiddleware($this->shareManager);
}
- public function testBeforeControllerNoShareInfo() {
+ public function testBeforeControllerNoShareInfo(): void {
$this->shareManager->expects($this->never())
->method($this->anything());
$this->middleware->beforeController($this->createMock(ShareInfoMiddlewareTestController::class), 'foo');
}
- public function testBeforeControllerShareInfoNoS2s() {
+ public function testBeforeControllerShareInfoNoS2s(): void {
$this->shareManager->expects($this->once())
->method('outgoingServer2ServerSharesAllowed')
->willReturn(false);
@@ -63,7 +47,7 @@ class ShareInfoMiddlewareTest extends TestCase {
$this->middleware->beforeController($this->createMock(ShareInfoController::class), 'foo');
}
- public function testBeforeControllerShareInfo() {
+ public function testBeforeControllerShareInfo(): void {
$this->shareManager->expects($this->once())
->method('outgoingServer2ServerSharesAllowed')
->willReturn(true);
@@ -71,7 +55,7 @@ class ShareInfoMiddlewareTest extends TestCase {
$this->middleware->beforeController($this->createMock(ShareInfoController::class), 'foo');
}
- public function testAfterExceptionNoShareInfo() {
+ public function testAfterExceptionNoShareInfo(): void {
$exeption = new \Exception();
try {
@@ -83,7 +67,7 @@ class ShareInfoMiddlewareTest extends TestCase {
}
- public function testAfterExceptionNoS2S() {
+ public function testAfterExceptionNoS2S(): void {
$exeption = new \Exception();
try {
@@ -94,7 +78,7 @@ class ShareInfoMiddlewareTest extends TestCase {
}
}
- public function testAfterExceptionS2S() {
+ public function testAfterExceptionS2S(): void {
$expected = new JSONResponse([], Http::STATUS_NOT_FOUND);
$this->assertEquals(
@@ -103,8 +87,8 @@ class ShareInfoMiddlewareTest extends TestCase {
);
}
- public function testAfterControllerNoShareInfo() {
- $response = $this->createMock(Http\Response::class);
+ public function testAfterControllerNoShareInfo(): void {
+ $response = $this->createMock(Response::class);
$this->assertEquals(
$response,
@@ -112,8 +96,8 @@ class ShareInfoMiddlewareTest extends TestCase {
);
}
- public function testAfterControllerNoJSON() {
- $response = $this->createMock(Http\Response::class);
+ public function testAfterControllerNoJSON(): void {
+ $response = $this->createMock(Response::class);
$this->assertEquals(
$response,
@@ -121,7 +105,7 @@ class ShareInfoMiddlewareTest extends TestCase {
);
}
- public function testAfterControllerJSONok() {
+ public function testAfterControllerJSONok(): void {
$data = ['foo' => 'bar'];
$response = new JSONResponse($data);
@@ -136,7 +120,7 @@ class ShareInfoMiddlewareTest extends TestCase {
);
}
- public function testAfterControllerJSONerror() {
+ public function testAfterControllerJSONerror(): void {
$data = ['foo' => 'bar'];
$response = new JSONResponse($data, Http::STATUS_FORBIDDEN);