aboutsummaryrefslogtreecommitdiffstats
path: root/apps/settings/tests
diff options
context:
space:
mode:
Diffstat (limited to 'apps/settings/tests')
-rw-r--r--apps/settings/tests/Activity/SecurityProviderTest.php4
-rw-r--r--apps/settings/tests/AppInfo/ApplicationTest.php4
-rw-r--r--apps/settings/tests/Controller/AuthSettingsControllerTest.php12
-rw-r--r--apps/settings/tests/Controller/MailSettingsControllerTest.php2
-rw-r--r--apps/settings/tests/Controller/UsersControllerTest.php24
-rw-r--r--apps/settings/tests/Settings/Admin/MailTest.php2
-rw-r--r--apps/settings/tests/Settings/Admin/SecurityTest.php6
-rw-r--r--apps/settings/tests/Settings/Personal/Security/AuthtokensTest.php2
-rw-r--r--apps/settings/tests/SetupChecks/DataDirectoryProtectedTest.php4
-rw-r--r--apps/settings/tests/SetupChecks/ForwardedForHeadersTest.php4
-rw-r--r--apps/settings/tests/SetupChecks/LoggingLevelTest.php2
-rw-r--r--apps/settings/tests/SetupChecks/SecurityHeadersTest.php8
-rw-r--r--apps/settings/tests/SetupChecks/WellKnownUrlsTest.php2
-rw-r--r--apps/settings/tests/UserMigration/AccountMigratorTest.php4
14 files changed, 24 insertions, 56 deletions
diff --git a/apps/settings/tests/Activity/SecurityProviderTest.php b/apps/settings/tests/Activity/SecurityProviderTest.php
index aa1c6592883..ed9de362a87 100644
--- a/apps/settings/tests/Activity/SecurityProviderTest.php
+++ b/apps/settings/tests/Activity/SecurityProviderTest.php
@@ -50,9 +50,7 @@ class SecurityProviderTest extends TestCase {
];
}
- /**
- * @dataProvider subjectData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('subjectData')]
public function testParse(string $subject): void {
$lang = 'ru';
$event = $this->createMock(IEvent::class);
diff --git a/apps/settings/tests/AppInfo/ApplicationTest.php b/apps/settings/tests/AppInfo/ApplicationTest.php
index 85be8c56178..b09412d8387 100644
--- a/apps/settings/tests/AppInfo/ApplicationTest.php
+++ b/apps/settings/tests/AppInfo/ApplicationTest.php
@@ -56,9 +56,7 @@ class ApplicationTest extends TestCase {
];
}
- /**
- * @dataProvider dataContainerQuery
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataContainerQuery')]
public function testContainerQuery(string $service, string $expected): void {
$this->assertTrue($this->container->query($service) instanceof $expected);
}
diff --git a/apps/settings/tests/Controller/AuthSettingsControllerTest.php b/apps/settings/tests/Controller/AuthSettingsControllerTest.php
index 37321d02915..d195dbf83d3 100644
--- a/apps/settings/tests/Controller/AuthSettingsControllerTest.php
+++ b/apps/settings/tests/Controller/AuthSettingsControllerTest.php
@@ -120,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);
@@ -137,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);
@@ -213,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);
@@ -253,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,
diff --git a/apps/settings/tests/Settings/Admin/MailTest.php b/apps/settings/tests/Settings/Admin/MailTest.php
index 97f59b9ea64..992c7d43dba 100644
--- a/apps/settings/tests/Settings/Admin/MailTest.php
+++ b/apps/settings/tests/Settings/Admin/MailTest.php
@@ -38,7 +38,7 @@ class MailTest extends TestCase {
];
}
- /** @dataProvider dataGetForm */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetForm')]
public function testGetForm(bool $sendmail) {
$finder = $this->createMock(IBinaryFinder::class);
$finder->expects(self::once())
diff --git a/apps/settings/tests/Settings/Admin/SecurityTest.php b/apps/settings/tests/Settings/Admin/SecurityTest.php
index fbb84854228..89a6d8c0d88 100644
--- a/apps/settings/tests/Settings/Admin/SecurityTest.php
+++ b/apps/settings/tests/Settings/Admin/SecurityTest.php
@@ -46,9 +46,7 @@ class SecurityTest extends TestCase {
];
}
- /**
- * @dataProvider encryptionSettingsProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('encryptionSettingsProvider')]
public function testGetFormWithOnlyOneBackend(bool $enabled): void {
$this->manager
->expects($this->once())
@@ -76,9 +74,9 @@ class SecurityTest extends TestCase {
}
/**
- * @dataProvider encryptionSettingsProvider
* @param bool $enabled
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('encryptionSettingsProvider')]
public function testGetFormWithMultipleBackends($enabled): void {
$this->manager
->expects($this->once())
diff --git a/apps/settings/tests/Settings/Personal/Security/AuthtokensTest.php b/apps/settings/tests/Settings/Personal/Security/AuthtokensTest.php
index f6f82ab311a..0a0ff4d84af 100644
--- a/apps/settings/tests/Settings/Personal/Security/AuthtokensTest.php
+++ b/apps/settings/tests/Settings/Personal/Security/AuthtokensTest.php
@@ -97,7 +97,7 @@ class AuthtokensTest extends TestCase {
];
$this->initialState->expects($this->exactly(2))
->method('provideInitialState')
- ->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/SetupChecks/DataDirectoryProtectedTest.php b/apps/settings/tests/SetupChecks/DataDirectoryProtectedTest.php
index a48c6296aff..c20c78c6e16 100644
--- a/apps/settings/tests/SetupChecks/DataDirectoryProtectedTest.php
+++ b/apps/settings/tests/SetupChecks/DataDirectoryProtectedTest.php
@@ -54,9 +54,7 @@ class DataDirectoryProtectedTest extends TestCase {
->getMock();
}
- /**
- * @dataProvider dataTestStatusCode
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestStatusCode')]
public function testStatusCode(array $status, string $expected, bool $hasBody): void {
$responses = array_map(function ($state) use ($hasBody) {
$response = $this->createMock(IResponse::class);
diff --git a/apps/settings/tests/SetupChecks/ForwardedForHeadersTest.php b/apps/settings/tests/SetupChecks/ForwardedForHeadersTest.php
index b57eb852d80..9b4878b45cc 100644
--- a/apps/settings/tests/SetupChecks/ForwardedForHeadersTest.php
+++ b/apps/settings/tests/SetupChecks/ForwardedForHeadersTest.php
@@ -43,9 +43,7 @@ class ForwardedForHeadersTest extends TestCase {
);
}
- /**
- * @dataProvider dataForwardedForHeadersWorking
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataForwardedForHeadersWorking')]
public function testForwardedForHeadersWorking(array $trustedProxies, string $remoteAddrNotForwarded, string $remoteAddr, string $result): void {
$this->config->expects($this->once())
->method('getSystemValue')
diff --git a/apps/settings/tests/SetupChecks/LoggingLevelTest.php b/apps/settings/tests/SetupChecks/LoggingLevelTest.php
index 9d588a4e486..67224e11e3a 100644
--- a/apps/settings/tests/SetupChecks/LoggingLevelTest.php
+++ b/apps/settings/tests/SetupChecks/LoggingLevelTest.php
@@ -59,7 +59,7 @@ class LoggingLevelTest extends TestCase {
];
}
- /** @dataProvider dataRun */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataRun')]
public function testRun(string|int $value, string $expected): void {
$this->urlGenerator->method('linkToDocs')->willReturn('admin-logging');
diff --git a/apps/settings/tests/SetupChecks/SecurityHeadersTest.php b/apps/settings/tests/SetupChecks/SecurityHeadersTest.php
index 17e631b0025..1f75907d427 100644
--- a/apps/settings/tests/SetupChecks/SecurityHeadersTest.php
+++ b/apps/settings/tests/SetupChecks/SecurityHeadersTest.php
@@ -106,9 +106,7 @@ class SecurityHeadersTest extends TestCase {
];
}
- /**
- * @dataProvider dataSuccess
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSuccess')]
public function testSuccess(array $headers): void {
$headers = array_merge(
[
@@ -147,9 +145,7 @@ class SecurityHeadersTest extends TestCase {
];
}
- /**
- * @dataProvider dataFailure
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataFailure')]
public function testFailure(array $headers, string $msg): void {
$headers = array_merge(
[
diff --git a/apps/settings/tests/SetupChecks/WellKnownUrlsTest.php b/apps/settings/tests/SetupChecks/WellKnownUrlsTest.php
index 14473a540ba..d55835d66fc 100644
--- a/apps/settings/tests/SetupChecks/WellKnownUrlsTest.php
+++ b/apps/settings/tests/SetupChecks/WellKnownUrlsTest.php
@@ -96,8 +96,8 @@ class WellKnownUrlsTest extends TestCase {
/**
* Test responses
- * @dataProvider dataTestResponses
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestResponses')]
public function testResponses($responses, string $expectedSeverity): void {
$this->config
->expects($this->once())
diff --git a/apps/settings/tests/UserMigration/AccountMigratorTest.php b/apps/settings/tests/UserMigration/AccountMigratorTest.php
index ded905d226c..b8f8301f777 100644
--- a/apps/settings/tests/UserMigration/AccountMigratorTest.php
+++ b/apps/settings/tests/UserMigration/AccountMigratorTest.php
@@ -85,9 +85,7 @@ class AccountMigratorTest extends TestCase {
);
}
- /**
- * @dataProvider dataImportExportAccount
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataImportExportAccount')]
public function testImportExportAccount(string $userId, array $importData, string $avatarPath, array $importConfig): void {
$user = $this->userManager->createUser($userId, 'topsecretpassword');
$avatarExt = pathinfo($avatarPath, PATHINFO_EXTENSION);