diff options
Diffstat (limited to 'apps/files_versions/tests/ExpirationTest.php')
-rw-r--r-- | apps/files_versions/tests/ExpirationTest.php | 53 |
1 files changed, 10 insertions, 43 deletions
diff --git a/apps/files_versions/tests/ExpirationTest.php b/apps/files_versions/tests/ExpirationTest.php index 228d1d6830c..8cf412c3fe0 100644 --- a/apps/files_versions/tests/ExpirationTest.php +++ b/apps/files_versions/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 Nextcloud GmbH and Nextcloud contributors + * SPDX-FileCopyrightText: 2016 ownCloud, Inc. + * SPDX-License-Identifier: AGPL-3.0-only */ namespace OCA\Files_Versions\Tests; @@ -34,7 +17,7 @@ use Psr\Log\LoggerInterface; class ExpirationTest extends \Test\TestCase { public const SECONDS_PER_DAY = 86400; //60*60*24 - 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; @@ -98,16 +81,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); $mockedLogger = $this->createMock(LoggerInterface::class); @@ -119,11 +94,7 @@ class ExpirationTest extends \Test\TestCase { } - /** - * @param int $time - * @return ITimeFactory|MockObject - */ - private function getMockedTimeFactory($time) { + private function getMockedTimeFactory(int $time): ITimeFactory&MockObject { $mockedTimeFactory = $this->createMock(ITimeFactory::class); $mockedTimeFactory->expects($this->any()) ->method('getTime') @@ -132,11 +103,7 @@ class ExpirationTest extends \Test\TestCase { return $mockedTimeFactory; } - /** - * @param string $returnValue - * @return IConfig|MockObject - */ - private function getMockedConfig($returnValue) { + private function getMockedConfig(string $returnValue): IConfig&MockObject { $mockedConfig = $this->createMock(IConfig::class); $mockedConfig->expects($this->any()) ->method('getSystemValue') |