aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/AppFramework/Controller/PublicShareControllerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/AppFramework/Controller/PublicShareControllerTest.php')
-rw-r--r--tests/lib/AppFramework/Controller/PublicShareControllerTest.php24
1 files changed, 10 insertions, 14 deletions
diff --git a/tests/lib/AppFramework/Controller/PublicShareControllerTest.php b/tests/lib/AppFramework/Controller/PublicShareControllerTest.php
index f8430d42ef1..e676b8a0d7e 100644
--- a/tests/lib/AppFramework/Controller/PublicShareControllerTest.php
+++ b/tests/lib/AppFramework/Controller/PublicShareControllerTest.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@@ -11,17 +12,14 @@ use OCP\IRequest;
use OCP\ISession;
class TestController extends PublicShareController {
- /** @var string */
- private $hash;
-
- /** @var bool */
- private $isProtected;
-
- public function __construct(string $appName, IRequest $request, ISession $session, string $hash, bool $isProtected) {
+ public function __construct(
+ string $appName,
+ IRequest $request,
+ ISession $session,
+ private string $hash,
+ private bool $isProtected,
+ ) {
parent::__construct($appName, $request, $session);
-
- $this->hash = $hash;
- $this->isProtected = $isProtected;
}
protected function getPasswordHash(): string {
@@ -57,7 +55,7 @@ class PublicShareControllerTest extends \Test\TestCase {
$this->assertEquals('test', $controller->getToken());
}
- public function dataIsAuthenticated() {
+ public static function dataIsAuthenticated(): array {
return [
[false, 'token1', 'token1', 'hash1', 'hash1', true],
[false, 'token1', 'token1', 'hash1', 'hash2', true],
@@ -70,9 +68,7 @@ class PublicShareControllerTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider dataIsAuthenticated
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataIsAuthenticated')]
public function testIsAuthenticatedNotPasswordProtected(bool $protected, string $token1, string $token2, string $hash1, string $hash2, bool $expected): void {
$controller = new TestController('app', $this->request, $this->session, $hash2, $protected);