diff options
Diffstat (limited to 'apps/settings/tests/Controller')
5 files changed, 14 insertions, 27 deletions
diff --git a/apps/settings/tests/Controller/AdminSettingsControllerTest.php b/apps/settings/tests/Controller/AdminSettingsControllerTest.php index 445e3971cf8..fbdc506457b 100644 --- a/apps/settings/tests/Controller/AdminSettingsControllerTest.php +++ b/apps/settings/tests/Controller/AdminSettingsControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/settings/tests/Controller/AppSettingsControllerTest.php b/apps/settings/tests/Controller/AppSettingsControllerTest.php index 5194ca2cc33..392bb7b561d 100644 --- a/apps/settings/tests/Controller/AppSettingsControllerTest.php +++ b/apps/settings/tests/Controller/AppSettingsControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2015 ownCloud, Inc. diff --git a/apps/settings/tests/Controller/AuthSettingsControllerTest.php b/apps/settings/tests/Controller/AuthSettingsControllerTest.php index bb6068ffe94..d195dbf83d3 100644 --- a/apps/settings/tests/Controller/AuthSettingsControllerTest.php +++ b/apps/settings/tests/Controller/AuthSettingsControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -119,7 +120,7 @@ class AuthSettingsControllerTest extends TestCase { $this->session->expects($this->once()) ->method('getId') - ->will($this->throwException(new SessionNotAvailableException())); + ->willThrowException(new SessionNotAvailableException()); $expected = new JSONResponse(); $expected->setStatus(Http::STATUS_SERVICE_UNAVAILABLE); @@ -136,7 +137,7 @@ class AuthSettingsControllerTest extends TestCase { $this->tokenProvider->expects($this->once()) ->method('getToken') ->with('sessionid') - ->will($this->throwException(new InvalidTokenException())); + ->willThrowException(new InvalidTokenException()); $expected = new JSONResponse(); $expected->setStatus(Http::STATUS_SERVICE_UNAVAILABLE); @@ -212,9 +213,7 @@ class AuthSettingsControllerTest extends TestCase { ]; } - /** - * @dataProvider dataRenameToken - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataRenameToken')] public function testUpdateRename(string $name, string $newName): void { $tokenId = 42; $token = $this->createMock(PublicKeyToken::class); @@ -252,9 +251,7 @@ class AuthSettingsControllerTest extends TestCase { ]; } - /** - * @dataProvider dataUpdateFilesystemScope - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataUpdateFilesystemScope')] public function testUpdateFilesystemScope(bool $filesystem, bool $newFilesystem): void { $tokenId = 42; $token = $this->createMock(PublicKeyToken::class); diff --git a/apps/settings/tests/Controller/MailSettingsControllerTest.php b/apps/settings/tests/Controller/MailSettingsControllerTest.php index dcb1e3efef4..1bc05ca4718 100644 --- a/apps/settings/tests/Controller/MailSettingsControllerTest.php +++ b/apps/settings/tests/Controller/MailSettingsControllerTest.php @@ -79,7 +79,7 @@ class MailSettingsControllerTest extends \Test\TestCase { ]; $this->config->expects($this->exactly(2)) ->method('setSystemValues') - ->willReturnCallback(function () use (&$calls) { + ->willReturnCallback(function () use (&$calls): void { $expected = array_shift($calls); $this->assertEquals($expected, func_get_args()); }); diff --git a/apps/settings/tests/Controller/UsersControllerTest.php b/apps/settings/tests/Controller/UsersControllerTest.php index d5fe38ad458..0468ce6814c 100644 --- a/apps/settings/tests/Controller/UsersControllerTest.php +++ b/apps/settings/tests/Controller/UsersControllerTest.php @@ -235,9 +235,7 @@ class UsersControllerTest extends \Test\TestCase { return $account; } - /** - * @dataProvider dataTestSetUserSettings - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataTestSetUserSettings')] public function testSetUserSettings(string $email, bool $validEmail, int $expectedStatus): void { $controller = $this->getController(false, ['saveUserSettings']); $user = $this->createMock(IUser::class); @@ -497,9 +495,7 @@ class UsersControllerTest extends \Test\TestCase { ); } - /** - * @dataProvider dataTestSetUserSettingsSubset - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataTestSetUserSettingsSubset')] public function testSetUserSettingsSubset(string $property, string $propertyValue): void { $controller = $this->getController(false, ['saveUserSettings']); $user = $this->createMock(IUser::class); @@ -641,9 +637,7 @@ class UsersControllerTest extends \Test\TestCase { ]; } - /** - * @dataProvider dataTestSaveUserSettings - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataTestSaveUserSettings')] public function testSaveUserSettings(array $data, ?string $oldEmailAddress, ?string $oldDisplayName): void { $controller = $this->getController(); $user = $this->createMock(IUser::class); @@ -758,9 +752,7 @@ class UsersControllerTest extends \Test\TestCase { ]; } - /** - * @dataProvider dataTestSaveUserSettingsException - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataTestSaveUserSettingsException')] public function testSaveUserSettingsException( array $data, string $oldEmailAddress, @@ -843,9 +835,7 @@ class UsersControllerTest extends \Test\TestCase { ]; } - /** - * @dataProvider dataTestGetVerificationCode - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetVerificationCode')] public function testGetVerificationCode(string $account, string $type, array $dataBefore, array $expectedData, bool $onlyVerificationCode): void { $message = 'Use my Federated Cloud ID to share with me: user@nextcloud.com'; $signature = 'theSignature'; @@ -940,9 +930,7 @@ class UsersControllerTest extends \Test\TestCase { $this->assertSame(Http::STATUS_BAD_REQUEST, $result->getStatus()); } - /** - * @dataProvider dataTestCanAdminChangeUserPasswords - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataTestCanAdminChangeUserPasswords')] public function testCanAdminChangeUserPasswords( bool $encryptionEnabled, bool $encryptionModuleLoaded, |