aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/tests/ExpirationTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_trashbin/tests/ExpirationTest.php')
-rw-r--r--apps/files_trashbin/tests/ExpirationTest.php60
1 files changed, 14 insertions, 46 deletions
diff --git a/apps/files_trashbin/tests/ExpirationTest.php b/apps/files_trashbin/tests/ExpirationTest.php
index 2f304b17881..3348edc4016 100644
--- a/apps/files_trashbin/tests/ExpirationTest.php
+++ b/apps/files_trashbin/tests/ExpirationTest.php
@@ -1,27 +1,10 @@
<?php
+
+declare(strict_types=1);
/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Joas Schilling <coding@schilljs.com>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- * @author Victor Dubiniuk <dubiniuk@owncloud.com>
- *
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * 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, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
+ * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
namespace OCA\Files_Trashbin\Tests;
@@ -35,7 +18,7 @@ class ExpirationTest extends \Test\TestCase {
public const FAKE_TIME_NOW = 1000000;
- public function expirationData() {
+ public static function expirationData(): array {
$today = 100 * self::SECONDS_PER_DAY;
$back10Days = (100 - 10) * self::SECONDS_PER_DAY;
$back20Days = (100 - 20) * self::SECONDS_PER_DAY;
@@ -99,16 +82,8 @@ class ExpirationTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider expirationData
- *
- * @param string $retentionObligation
- * @param int $timeNow
- * @param int $timestamp
- * @param bool $quotaExceeded
- * @param string $expectedResult
- */
- public function testExpiration($retentionObligation, $timeNow, $timestamp, $quotaExceeded, $expectedResult) {
+ #[\PHPUnit\Framework\Attributes\DataProvider('expirationData')]
+ public function testExpiration(string $retentionObligation, int $timeNow, int $timestamp, bool $quotaExceeded, bool $expectedResult): void {
$mockedConfig = $this->getMockedConfig($retentionObligation);
$mockedTimeFactory = $this->getMockedTimeFactory($timeNow);
@@ -119,7 +94,7 @@ class ExpirationTest extends \Test\TestCase {
}
- public function timestampTestData(): array {
+ public static function timestampTestData(): array {
return [
[ 'disabled', false],
[ 'auto', false ],
@@ -133,16 +108,11 @@ class ExpirationTest extends \Test\TestCase {
}
- /**
- * @dataProvider timestampTestData
- *
- * @param string $configValue
- * @param int $expectedMaxAgeTimestamp
- */
- public function testGetMaxAgeAsTimestamp($configValue, $expectedMaxAgeTimestamp) {
+ #[\PHPUnit\Framework\Attributes\DataProvider('timestampTestData')]
+ public function testGetMaxAgeAsTimestamp(string $configValue, bool|int $expectedMaxAgeTimestamp): void {
$mockedConfig = $this->getMockedConfig($configValue);
$mockedTimeFactory = $this->getMockedTimeFactory(
- self::FAKE_TIME_NOW
+ self::FAKE_TIME_NOW
);
$expiration = new Expiration($mockedConfig, $mockedTimeFactory);
@@ -151,10 +121,9 @@ class ExpirationTest extends \Test\TestCase {
}
/**
- * @param int $time
* @return ITimeFactory|MockObject
*/
- private function getMockedTimeFactory($time) {
+ private function getMockedTimeFactory(int $time) {
$mockedTimeFactory = $this->createMock(ITimeFactory::class);
$mockedTimeFactory->expects($this->any())
->method('getTime')
@@ -164,10 +133,9 @@ class ExpirationTest extends \Test\TestCase {
}
/**
- * @param string $returnValue
* @return IConfig|MockObject
*/
- private function getMockedConfig($returnValue) {
+ private function getMockedConfig(string $returnValue) {
$mockedConfig = $this->createMock(IConfig::class);
$mockedConfig->expects($this->any())
->method('getSystemValue')