aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Core/Command/Apps/AppsDisableTest.php2
-rw-r--r--tests/Core/Command/Apps/AppsEnableTest.php2
-rw-r--r--tests/Core/Command/Config/App/DeleteConfigTest.php4
-rw-r--r--tests/Core/Command/Config/App/GetConfigTest.php4
-rw-r--r--tests/Core/Command/Config/App/SetConfigTest.php4
-rw-r--r--tests/Core/Command/Config/ImportTest.php19
-rw-r--r--tests/Core/Command/Config/ListConfigsTest.php2
-rw-r--r--tests/Core/Command/Config/System/CastHelperTest.php8
-rw-r--r--tests/Core/Command/Config/System/DeleteConfigTest.php6
-rw-r--r--tests/Core/Command/Config/System/GetConfigTest.php4
-rw-r--r--tests/Core/Command/Config/System/SetConfigTest.php8
-rw-r--r--tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php18
-rw-r--r--tests/Core/Command/Encryption/DecryptAllTest.php8
-rw-r--r--tests/Core/Command/Encryption/DisableTest.php4
-rw-r--r--tests/Core/Command/Encryption/EnableTest.php4
-rw-r--r--tests/Core/Command/Encryption/EncryptAllTest.php10
-rw-r--r--tests/Core/Command/Encryption/SetDefaultModuleTest.php4
-rw-r--r--tests/Core/Command/Log/FileTest.php4
-rw-r--r--tests/Core/Command/Log/ManageTest.php8
-rw-r--r--tests/Core/Command/Maintenance/DataFingerprintTest.php2
-rw-r--r--tests/Core/Command/Maintenance/ModeTest.php2
-rw-r--r--tests/Core/Command/Preview/CleanupTest.php4
-rw-r--r--tests/Core/Command/Preview/RepairTest.php4
-rw-r--r--tests/Core/Command/User/AddTest.php4
-rw-r--r--tests/Core/Command/User/DeleteTest.php4
-rw-r--r--tests/Core/Command/User/LastSeenTest.php4
-rw-r--r--tests/Core/Command/User/ProfileTest.php11
-rw-r--r--tests/Core/Command/User/SettingTest.php8
-rw-r--r--tests/Core/Controller/AutoCompleteControllerTest.php4
-rw-r--r--tests/Core/Controller/ClientFlowLoginControllerTest.php2
-rw-r--r--tests/Core/Controller/GuestAvatarControllerTest.php3
-rw-r--r--tests/Core/Controller/LoginControllerTest.php4
-rw-r--r--tests/Core/Controller/LostControllerTest.php2
-rw-r--r--tests/Core/Controller/NavigationControllerTest.php4
-rw-r--r--tests/Core/Controller/WipeControllerTest.php6
-rw-r--r--tests/Core/Data/LoginFlowV2CredentialsTest.php2
-rw-r--r--tests/Core/Middleware/TwoFactorMiddlewareTest.php4
-rw-r--r--tests/Core/Service/LoginFlowV2ServiceUnitTest.php12
-rw-r--r--tests/lib/Accounts/AccountManagerTest.php29
-rw-r--r--tests/lib/Accounts/AccountPropertyTest.php4
-rw-r--r--tests/lib/Accounts/HooksTest.php2
-rw-r--r--tests/lib/Activity/ManagerTest.php6
-rw-r--r--tests/lib/AllConfigTest.php4
-rw-r--r--tests/lib/App/AppManagerTest.php13
-rw-r--r--tests/lib/App/AppStore/Fetcher/AppDiscoverFetcherTest.php4
-rw-r--r--tests/lib/App/AppStore/Version/VersionParserTest.php2
-rw-r--r--tests/lib/App/CompareVersionTest.php4
-rw-r--r--tests/lib/App/DependencyAnalyzerTest.php12
-rw-r--r--tests/lib/App/InfoParserTest.php10
-rw-r--r--tests/lib/App/PlatformRepositoryTest.php2
-rw-r--r--tests/lib/AppConfigTest.php18
-rw-r--r--tests/lib/AppFramework/AppTest.php4
-rw-r--r--tests/lib/AppFramework/Bootstrap/RegistrationContextTest.php4
-rw-r--r--tests/lib/AppFramework/Controller/PublicShareControllerTest.php4
-rw-r--r--tests/lib/AppFramework/Db/EntityTest.php4
-rw-r--r--tests/lib/AppFramework/Db/QBMapperDBTest.php2
-rw-r--r--tests/lib/AppFramework/Db/TransactionalTest.php14
-rw-r--r--tests/lib/AppFramework/Http/DispatcherTest.php6
-rw-r--r--tests/lib/AppFramework/Http/DownloadResponseTest.php4
-rw-r--r--tests/lib/AppFramework/Http/JSONResponseTest.php2
-rw-r--r--tests/lib/AppFramework/Http/RequestTest.php36
-rw-r--r--tests/lib/AppFramework/Http/ResponseTest.php2
-rw-r--r--tests/lib/AppFramework/Http/TemplateResponseTest.php2
-rw-r--r--tests/lib/AppFramework/Middleware/NotModifiedMiddlewareTest.php4
-rw-r--r--tests/lib/AppFramework/Middleware/OCSMiddlewareTest.php16
-rw-r--r--tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php4
-rw-r--r--tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php32
-rw-r--r--tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php8
-rw-r--r--tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php100
-rw-r--r--tests/lib/AppFramework/OCS/V2ResponseTest.php4
-rw-r--r--tests/lib/AppFramework/Services/AppConfigTest.php57
-rw-r--r--tests/lib/AppFramework/Utility/SimpleContainerTest.php4
-rw-r--r--tests/lib/AppTest.php11
-rw-r--r--tests/lib/Authentication/Token/ManagerTest.php16
-rw-r--r--tests/lib/Authentication/TwoFactorAuth/ManagerTest.php3
-rw-r--r--tests/lib/Avatar/AvatarManagerTest.php4
-rw-r--r--tests/lib/Avatar/UserAvatarTest.php10
-rw-r--r--tests/lib/BackgroundJob/DummyJobList.php3
-rw-r--r--tests/lib/BackgroundJob/JobListTest.php16
-rw-r--r--tests/lib/Cache/FileCacheTest.php9
-rw-r--r--tests/lib/Cache/TestCache.php4
-rw-r--r--tests/lib/Calendar/ManagerTest.php8
-rw-r--r--tests/lib/Collaboration/Collaborators/GroupPluginTest.php2
-rw-r--r--tests/lib/Collaboration/Collaborators/LookupPluginTest.php4
-rw-r--r--tests/lib/Collaboration/Collaborators/MailPluginTest.php6
-rw-r--r--tests/lib/Collaboration/Collaborators/RemotePluginTest.php7
-rw-r--r--tests/lib/Collaboration/Collaborators/SearchResultTest.php4
-rw-r--r--tests/lib/Collaboration/Collaborators/SearchTest.php4
-rw-r--r--tests/lib/Collaboration/Collaborators/UserPluginTest.php8
-rw-r--r--tests/lib/Command/AsyncBusTestCase.php2
-rw-r--r--tests/lib/Command/BackgroundModeTest.php4
-rw-r--r--tests/lib/Command/CronBusTest.php3
-rw-r--r--tests/lib/Comments/CommentTest.php14
-rw-r--r--tests/lib/Comments/ManagerTest.php44
-rw-r--r--tests/lib/Config/UserConfigTest.php120
-rw-r--r--tests/lib/Contacts/ContactsMenu/Providers/LocalTimeProviderTest.php4
-rw-r--r--tests/lib/ContactsManagerTest.php8
-rw-r--r--tests/lib/DB/ConnectionFactoryTest.php2
-rw-r--r--tests/lib/DB/Exception/DbalExceptionTest.php2
-rw-r--r--tests/lib/DB/MigrationsTest.php2
-rw-r--r--tests/lib/DB/MigratorTest.php2
-rw-r--r--tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php6
-rw-r--r--tests/lib/DB/QueryBuilder/ExpressionBuilderTest.php28
-rw-r--r--tests/lib/DB/QueryBuilder/FunctionBuilderTest.php14
-rw-r--r--tests/lib/DB/QueryBuilder/Partitioned/JoinConditionTest.php8
-rw-r--r--tests/lib/DB/QueryBuilder/QueryBuilderTest.php56
-rw-r--r--tests/lib/DB/QueryBuilder/QuoteHelperTest.php4
-rw-r--r--tests/lib/DateTimeFormatterTest.php16
-rw-r--r--tests/lib/EmojiHelperTest.php6
-rw-r--r--tests/lib/Encryption/DecryptAllTest.php14
-rw-r--r--tests/lib/Encryption/EncryptionWrapperTest.php6
-rw-r--r--tests/lib/Encryption/Keys/StorageTest.php14
-rw-r--r--tests/lib/Encryption/ManagerTest.php2
-rw-r--r--tests/lib/Encryption/UpdateTest.php4
-rw-r--r--tests/lib/Encryption/UtilTest.php24
-rw-r--r--tests/lib/ErrorHandlerTest.php2
-rw-r--r--tests/lib/Federation/CloudIdManagerTest.php16
-rw-r--r--tests/lib/Federation/CloudIdTest.php4
-rw-r--r--tests/lib/Files/Cache/CacheTest.php25
-rw-r--r--tests/lib/Files/Cache/HomeCacheTest.php2
-rw-r--r--tests/lib/Files/Cache/ScannerTest.php2
-rw-r--r--tests/lib/Files/Cache/SearchBuilderTest.php2
-rw-r--r--tests/lib/Files/Cache/UpdaterLegacyTest.php9
-rw-r--r--tests/lib/Files/Cache/UpdaterTest.php13
-rw-r--r--tests/lib/Files/Cache/WatcherTest.php5
-rw-r--r--tests/lib/Files/Cache/Wrapper/CacheJailTest.php3
-rw-r--r--tests/lib/Files/Cache/Wrapper/CachePermissionsMaskTest.php9
-rw-r--r--tests/lib/Files/FilenameValidatorTest.php40
-rw-r--r--tests/lib/Files/FilesystemTest.php19
-rw-r--r--tests/lib/Files/Node/FolderTest.php18
-rw-r--r--tests/lib/Files/Node/HookConnectorTest.php4
-rw-r--r--tests/lib/Files/Node/IntegrationTest.php5
-rw-r--r--tests/lib/Files/Node/NodeTestCase.php21
-rw-r--r--tests/lib/Files/Node/RootTest.php13
-rw-r--r--tests/lib/Files/ObjectStore/FailDeleteObjectStore.php7
-rw-r--r--tests/lib/Files/ObjectStore/FailWriteObjectStore.php7
-rw-r--r--tests/lib/Files/ObjectStore/LocalTest.php3
-rw-r--r--tests/lib/Files/ObjectStore/MapperTest.php2
-rw-r--r--tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php4
-rw-r--r--tests/lib/Files/ObjectStore/ObjectStoreStoragesDifferentBucketTest.php5
-rw-r--r--tests/lib/Files/ObjectStore/ObjectStoreStoragesSameBucketTest.php3
-rw-r--r--tests/lib/Files/ObjectStore/ObjectStoreTestCase.php3
-rw-r--r--tests/lib/Files/ObjectStore/S3Test.php2
-rw-r--r--tests/lib/Files/ObjectStore/SwiftTest.php3
-rw-r--r--tests/lib/Files/PathVerificationTest.php18
-rw-r--r--tests/lib/Files/Storage/HomeTest.php2
-rw-r--r--tests/lib/Files/Storage/Storage.php35
-rw-r--r--tests/lib/Files/Storage/StoragesTestCase.php5
-rw-r--r--tests/lib/Files/Storage/Wrapper/EncodingTest.php34
-rw-r--r--tests/lib/Files/Storage/Wrapper/EncryptionTest.php23
-rw-r--r--tests/lib/Files/Storage/Wrapper/JailTest.php2
-rw-r--r--tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php2
-rw-r--r--tests/lib/Files/Stream/EncryptionTest.php11
-rw-r--r--tests/lib/Files/Stream/HashWrapperTest.php4
-rw-r--r--tests/lib/Files/Type/DetectionTest.php10
-rw-r--r--tests/lib/Files/Utils/ScannerTest.php6
-rw-r--r--tests/lib/Files/ViewTest.php76
-rw-r--r--tests/lib/GlobalScale/ConfigTest.php2
-rw-r--r--tests/lib/Group/ManagerTest.php4
-rw-r--r--tests/lib/HelperStorageTest.php7
-rw-r--r--tests/lib/Hooks/BasicEmitterTest.php3
-rw-r--r--tests/lib/Http/Client/ClientTest.php14
-rw-r--r--tests/lib/ImageTest.php10
-rw-r--r--tests/lib/InfoXmlTest.php3
-rw-r--r--tests/lib/InitialStateServiceTest.php8
-rw-r--r--tests/lib/InstallerTest.php2
-rw-r--r--tests/lib/IntegrityCheck/CheckerTest.php4
-rw-r--r--tests/lib/IntegrityCheck/Iterator/ExcludeFileByNameFilterIteratorTest.php4
-rw-r--r--tests/lib/L10N/FactoryTest.php25
-rw-r--r--tests/lib/L10N/L10nTest.php16
-rw-r--r--tests/lib/L10N/LanguageIteratorTest.php4
-rw-r--r--tests/lib/LargeFileHelperGetFileSizeTest.php12
-rw-r--r--tests/lib/LegacyHelperTest.php4
-rw-r--r--tests/lib/Lock/DBLockingProviderTest.php6
-rw-r--r--tests/lib/Lock/LockingProvider.php4
-rw-r--r--tests/lib/Lock/MemcacheLockingProviderTest.php6
-rw-r--r--tests/lib/Lock/NonCachingDBLockingProviderTest.php2
-rw-r--r--tests/lib/Log/LogFactoryTest.php15
-rw-r--r--tests/lib/Log/PsrLoggerAdapterTest.php12
-rw-r--r--tests/lib/LoggerTest.php24
-rw-r--r--tests/lib/Mail/MailerTest.php8
-rw-r--r--tests/lib/Mail/MessageTest.php2
-rw-r--r--tests/lib/Memcache/Cache.php4
-rw-r--r--tests/lib/Memcache/FactoryTest.php8
-rw-r--r--tests/lib/MemoryInfoTest.php4
-rw-r--r--tests/lib/NaturalSortTest.php8
-rw-r--r--tests/lib/NavigationManagerTest.php14
-rw-r--r--tests/lib/Net/HostnameClassifierTest.php8
-rw-r--r--tests/lib/Net/IpAddressClassifierTest.php8
-rw-r--r--tests/lib/Notification/ActionTest.php14
-rw-r--r--tests/lib/Notification/ManagerTest.php2
-rw-r--r--tests/lib/Notification/NotificationTest.php70
-rw-r--r--tests/lib/OCS/ApiHelperTest.php4
-rw-r--r--tests/lib/OCS/DiscoveryServiceTest.php4
-rw-r--r--tests/lib/OCS/ProviderTest.php6
-rw-r--r--tests/lib/Preview/GeneratorTest.php2
-rw-r--r--tests/lib/Preview/Provider.php9
-rw-r--r--tests/lib/Preview/SVGTest.php2
-rw-r--r--tests/lib/Profile/Actions/FediverseActionTest.php4
-rw-r--r--tests/lib/Repair/ClearGeneratedAvatarCacheTest.php2
-rw-r--r--tests/lib/Repair/RepairInvalidSharesTest.php3
-rw-r--r--tests/lib/RichObjectStrings/DefinitionsTest.php2
-rw-r--r--tests/lib/RichObjectStrings/ValidatorTest.php4
-rw-r--r--tests/lib/Security/Bruteforce/Backend/MemoryCacheBackendTest.php4
-rw-r--r--tests/lib/Security/CSRF/CsrfTokenGeneratorTest.php3
-rw-r--r--tests/lib/Security/CSRF/TokenStorage/SessionStorageTest.php4
-rw-r--r--tests/lib/Security/CertificateManagerTest.php4
-rw-r--r--tests/lib/Security/CredentialsManagerTest.php8
-rw-r--r--tests/lib/Security/CryptoTest.php4
-rw-r--r--tests/lib/Security/HasherTest.php16
-rw-r--r--tests/lib/Security/Ip/BruteforceAllowListTest.php3
-rw-r--r--tests/lib/Security/Ip/RemoteAddressTest.php2
-rw-r--r--tests/lib/Security/Normalizer/IpAddressTest.php2
-rw-r--r--tests/lib/Security/RemoteHostValidatorIntegrationTest.php12
-rw-r--r--tests/lib/Security/RemoteHostValidatorTest.php4
-rw-r--r--tests/lib/Security/SecureRandomTest.php20
-rw-r--r--tests/lib/Security/TrustedDomainHelperTest.php4
-rw-r--r--tests/lib/ServerTest.php4
-rw-r--r--tests/lib/Session/CryptoSessionDataTest.php5
-rw-r--r--tests/lib/Session/CryptoWrappingTest.php5
-rw-r--r--tests/lib/Settings/DeclarativeManagerTest.php4
-rw-r--r--tests/lib/SetupCheck/CheckServerResponseTraitTest.php8
-rw-r--r--tests/lib/SetupTest.php2
-rw-r--r--tests/lib/Share/HelperTest.php6
-rw-r--r--tests/lib/Share/ShareTest.php4
-rw-r--r--tests/lib/Share20/DefaultShareProviderTest.php32
-rw-r--r--tests/lib/Share20/ManagerTest.php76
-rw-r--r--tests/lib/Share20/ShareHelperTest.php10
-rw-r--r--tests/lib/Share20/ShareTest.php3
-rw-r--r--tests/lib/SubAdminTest.php12
-rw-r--r--tests/lib/Support/Subscription/RegistryTest.php4
-rw-r--r--tests/lib/SystemTag/SystemTagManagerTest.php40
-rw-r--r--tests/lib/TagsTest.php7
-rw-r--r--tests/lib/Template/JSCombinerTest.php2
-rw-r--r--tests/lib/TemplateLayoutTest.php2
-rw-r--r--tests/lib/TestCase.php3
-rw-r--r--tests/lib/Traits/EncryptionTrait.php4
-rw-r--r--tests/lib/Traits/MountProviderTrait.php3
-rw-r--r--tests/lib/Traits/UserTrait.php3
-rw-r--r--tests/lib/Updater/ChangesCheckTest.php21
-rw-r--r--tests/lib/Updater/ReleaseMetadataTest.php2
-rw-r--r--tests/lib/UpdaterTest.php2
-rw-r--r--tests/lib/UrlGeneratorTest.php20
-rw-r--r--tests/lib/User/ManagerTest.php4
-rw-r--r--tests/lib/User/SessionTest.php4
-rw-r--r--tests/lib/User/UserTest.php6
-rw-r--r--tests/lib/UtilCheckServerTest.php3
-rw-r--r--tests/lib/UtilTest.php8
248 files changed, 894 insertions, 1527 deletions
diff --git a/tests/Core/Command/Apps/AppsDisableTest.php b/tests/Core/Command/Apps/AppsDisableTest.php
index 283727c1a04..117af958054 100644
--- a/tests/Core/Command/Apps/AppsDisableTest.php
+++ b/tests/Core/Command/Apps/AppsDisableTest.php
@@ -37,12 +37,12 @@ class AppsDisableTest extends TestCase {
}
/**
- * @dataProvider dataCommandInput
* @param $appId
* @param $groups
* @param $statusCode
* @param $pattern
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataCommandInput')]
public function testCommandInput($appId, $statusCode, $pattern): void {
$input = ['app-id' => $appId];
diff --git a/tests/Core/Command/Apps/AppsEnableTest.php b/tests/Core/Command/Apps/AppsEnableTest.php
index efaa7da984b..604c670ae15 100644
--- a/tests/Core/Command/Apps/AppsEnableTest.php
+++ b/tests/Core/Command/Apps/AppsEnableTest.php
@@ -41,12 +41,12 @@ class AppsEnableTest extends TestCase {
}
/**
- * @dataProvider dataCommandInput
* @param $appId
* @param $groups
* @param $statusCode
* @param $pattern
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataCommandInput')]
public function testCommandInput($appId, $groups, $statusCode, $pattern): void {
$input = ['app-id' => $appId];
diff --git a/tests/Core/Command/Config/App/DeleteConfigTest.php b/tests/Core/Command/Config/App/DeleteConfigTest.php
index 6f7bfbf3a7c..9e43f389214 100644
--- a/tests/Core/Command/Config/App/DeleteConfigTest.php
+++ b/tests/Core/Command/Config/App/DeleteConfigTest.php
@@ -70,9 +70,7 @@ class DeleteConfigTest extends TestCase {
];
}
- /**
- * @dataProvider dataDelete
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataDelete')]
public function testDelete(string $configName, bool $configExists, bool $checkIfExists, int $expectedReturn, string $expectedMessage): void {
$this->appConfig->expects(($checkIfExists) ? $this->once() : $this->never())
->method('getKeys')
diff --git a/tests/Core/Command/Config/App/GetConfigTest.php b/tests/Core/Command/Config/App/GetConfigTest.php
index 63a02f263d0..13392cddf55 100644
--- a/tests/Core/Command/Config/App/GetConfigTest.php
+++ b/tests/Core/Command/Config/App/GetConfigTest.php
@@ -80,9 +80,7 @@ class GetConfigTest extends TestCase {
];
}
- /**
- * @dataProvider dataGet
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGet')]
public function testGet(string $configName, mixed $value, bool $configExists, mixed $defaultValue, bool $hasDefault, string $outputFormat, int $expectedReturn, ?string $expectedMessage): void {
if (!$expectedReturn) {
if ($configExists) {
diff --git a/tests/Core/Command/Config/App/SetConfigTest.php b/tests/Core/Command/Config/App/SetConfigTest.php
index 596439d85a8..a5c62368163 100644
--- a/tests/Core/Command/Config/App/SetConfigTest.php
+++ b/tests/Core/Command/Config/App/SetConfigTest.php
@@ -60,9 +60,7 @@ class SetConfigTest extends TestCase {
];
}
- /**
- * @dataProvider dataSet
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSet')]
public function testSet(string $configName, mixed $newValue, bool $configExists, bool $updateOnly, bool $updated, string $expectedMessage): void {
$this->appConfig->method('hasKey')
->with('app-name', $configName)
diff --git a/tests/Core/Command/Config/ImportTest.php b/tests/Core/Command/Config/ImportTest.php
index 4606b57f078..14cdd714d12 100644
--- a/tests/Core/Command/Config/ImportTest.php
+++ b/tests/Core/Command/Config/ImportTest.php
@@ -35,7 +35,7 @@ class ImportTest extends TestCase {
$this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
$this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
- /** @var \OCP\IConfig $config */
+ /** @var IConfig $config */
$this->command = new Import($config);
}
@@ -50,10 +50,9 @@ class ImportTest extends TestCase {
}
/**
- * @dataProvider validateAppsArrayData
- *
* @param mixed $configValue
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('validateAppsArrayData')]
public function testValidateAppsArray($configValue): void {
$this->invokePrivate($this->command, 'validateAppsArray', [['app' => ['name' => $configValue]]]);
$this->assertTrue(true, 'Asserting that no exception is thrown');
@@ -69,10 +68,9 @@ class ImportTest extends TestCase {
}
/**
- * @dataProvider validateAppsArrayThrowsData
- *
* @param mixed $configValue
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('validateAppsArrayThrowsData')]
public function testValidateAppsArrayThrows($configValue): void {
try {
$this->invokePrivate($this->command, 'validateAppsArray', [['app' => ['name' => $configValue]]]);
@@ -99,10 +97,9 @@ class ImportTest extends TestCase {
}
/**
- * @dataProvider checkTypeRecursivelyData
- *
* @param mixed $configValue
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('checkTypeRecursivelyData')]
public function testCheckTypeRecursively($configValue): void {
$this->invokePrivate($this->command, 'checkTypeRecursively', [$configValue, 'name']);
$this->assertTrue(true, 'Asserting that no exception is thrown');
@@ -118,10 +115,9 @@ class ImportTest extends TestCase {
}
/**
- * @dataProvider checkTypeRecursivelyThrowsData
- *
* @param mixed $configValue
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('checkTypeRecursivelyThrowsData')]
public function testCheckTypeRecursivelyThrows($configValue): void {
try {
$this->invokePrivate($this->command, 'checkTypeRecursively', [$configValue, 'name']);
@@ -140,10 +136,9 @@ class ImportTest extends TestCase {
}
/**
- * @dataProvider validateArrayData
- *
* @param array $configArray
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('validateArrayData')]
public function testValidateArray($configArray): void {
$this->invokePrivate($this->command, 'validateArray', [$configArray]);
$this->assertTrue(true, 'Asserting that no exception is thrown');
@@ -158,11 +153,11 @@ class ImportTest extends TestCase {
}
/**
- * @dataProvider validateArrayThrowsData
*
* @param mixed $configArray
* @param string $expectedException
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('validateArrayThrowsData')]
public function testValidateArrayThrows($configArray, $expectedException): void {
try {
$this->invokePrivate($this->command, 'validateArray', [$configArray]);
diff --git a/tests/Core/Command/Config/ListConfigsTest.php b/tests/Core/Command/Config/ListConfigsTest.php
index 4922fe2c185..2f2de288e9d 100644
--- a/tests/Core/Command/Config/ListConfigsTest.php
+++ b/tests/Core/Command/Config/ListConfigsTest.php
@@ -262,7 +262,6 @@ class ListConfigsTest extends TestCase {
}
/**
- * @dataProvider listData
*
* @param string $app
* @param array $systemConfigs
@@ -271,6 +270,7 @@ class ListConfigsTest extends TestCase {
* @param bool $private
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('listData')]
public function testList($app, $systemConfigs, $systemConfigMap, $appConfig, $private, $expected): void {
$this->systemConfig->expects($this->any())
->method('getKeys')
diff --git a/tests/Core/Command/Config/System/CastHelperTest.php b/tests/Core/Command/Config/System/CastHelperTest.php
index e31f74b4a55..924887daaf7 100644
--- a/tests/Core/Command/Config/System/CastHelperTest.php
+++ b/tests/Core/Command/Config/System/CastHelperTest.php
@@ -37,9 +37,7 @@ class CastHelperTest extends TestCase {
];
}
- /**
- * @dataProvider castValueProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('castValueProvider')]
public function testCastValue($value, $type, $expectedValue): void {
$this->assertSame(
$expectedValue,
@@ -59,9 +57,7 @@ class CastHelperTest extends TestCase {
];
}
- /**
- * @dataProvider castValueInvalidProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('castValueInvalidProvider')]
public function testCastValueInvalid($value, $type): void {
$this->expectException(\InvalidArgumentException::class);
diff --git a/tests/Core/Command/Config/System/DeleteConfigTest.php b/tests/Core/Command/Config/System/DeleteConfigTest.php
index b40d2a9cdd1..b0a3580e1cd 100644
--- a/tests/Core/Command/Config/System/DeleteConfigTest.php
+++ b/tests/Core/Command/Config/System/DeleteConfigTest.php
@@ -35,7 +35,7 @@ class DeleteConfigTest extends TestCase {
$this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
$this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
- /** @var \OC\SystemConfig $systemConfig */
+ /** @var SystemConfig $systemConfig */
$this->command = new DeleteConfig($systemConfig);
}
@@ -73,7 +73,6 @@ class DeleteConfigTest extends TestCase {
}
/**
- * @dataProvider deleteData
*
* @param string $configName
* @param bool $configExists
@@ -81,6 +80,7 @@ class DeleteConfigTest extends TestCase {
* @param int $expectedReturn
* @param string $expectedMessage
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('deleteData')]
public function testDelete($configName, $configExists, $checkIfExists, $expectedReturn, $expectedMessage): void {
$this->systemConfig->expects(($checkIfExists) ? $this->once() : $this->never())
->method('getKeys')
@@ -166,7 +166,6 @@ class DeleteConfigTest extends TestCase {
}
/**
- * @dataProvider deleteArrayData
*
* @param string[] $configNames
* @param bool $configKeyExists
@@ -176,6 +175,7 @@ class DeleteConfigTest extends TestCase {
* @param int $expectedReturn
* @param string $expectedMessage
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('deleteArrayData')]
public function testArrayDelete(array $configNames, $configKeyExists, $checkIfKeyExists, $configValue, $updateValue, $expectedReturn, $expectedMessage): void {
$this->systemConfig->expects(($checkIfKeyExists) ? $this->once() : $this->never())
->method('getKeys')
diff --git a/tests/Core/Command/Config/System/GetConfigTest.php b/tests/Core/Command/Config/System/GetConfigTest.php
index bcab8afa3be..8b84fd14198 100644
--- a/tests/Core/Command/Config/System/GetConfigTest.php
+++ b/tests/Core/Command/Config/System/GetConfigTest.php
@@ -35,7 +35,7 @@ class GetConfigTest extends TestCase {
$this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
$this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
- /** @var \OC\SystemConfig $systemConfig */
+ /** @var SystemConfig $systemConfig */
$this->command = new GetConfig($systemConfig);
}
@@ -89,7 +89,6 @@ class GetConfigTest extends TestCase {
}
/**
- * @dataProvider getData
*
* @param string[] $configNames
* @param mixed $value
@@ -100,6 +99,7 @@ class GetConfigTest extends TestCase {
* @param int $expectedReturn
* @param string $expectedMessage
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('getData')]
public function testGet($configNames, $value, $configExists, $defaultValue, $hasDefault, $outputFormat, $expectedReturn, $expectedMessage): void {
if (is_array($configNames)) {
$configName = $configNames[0];
diff --git a/tests/Core/Command/Config/System/SetConfigTest.php b/tests/Core/Command/Config/System/SetConfigTest.php
index b0c7e1580c3..a99b832c160 100644
--- a/tests/Core/Command/Config/System/SetConfigTest.php
+++ b/tests/Core/Command/Config/System/SetConfigTest.php
@@ -36,7 +36,7 @@ class SetConfigTest extends TestCase {
$this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
$this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
- /** @var \OC\SystemConfig $systemConfig */
+ /** @var SystemConfig $systemConfig */
$this->command = new SetConfig($systemConfig, new CastHelper());
}
@@ -50,13 +50,13 @@ class SetConfigTest extends TestCase {
}
/**
- * @dataProvider dataTest
*
* @param array $configNames
* @param string $newValue
* @param mixed $existingData
* @param mixed $expectedValue
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTest')]
public function testSet($configNames, $newValue, $existingData, $expectedValue): void {
$this->systemConfig->expects($this->once())
->method('setValue')
@@ -87,9 +87,7 @@ class SetConfigTest extends TestCase {
];
}
- /**
- * @dataProvider setUpdateOnlyProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('setUpdateOnlyProvider')]
public function testSetUpdateOnly($configNames, $existingData): void {
$this->expectException(\UnexpectedValueException::class);
diff --git a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php
index 789f6269e18..0bc6cbb64cf 100644
--- a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php
+++ b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php
@@ -46,7 +46,7 @@ class ChangeKeyStorageRootTest extends TestCase {
/** @var OutputInterface | \PHPUnit\Framework\MockObject\MockObject */
protected $outputInterface;
- /** @var \OCP\UserInterface | \PHPUnit\Framework\MockObject\MockObject */
+ /** @var UserInterface|\PHPUnit\Framework\MockObject\MockObject */
protected $userInterface;
protected function setUp(): void {
@@ -78,9 +78,7 @@ class ChangeKeyStorageRootTest extends TestCase {
);
}
- /**
- * @dataProvider dataTestExecute
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestExecute')]
public function testExecute($newRoot, $answer, $successMoveKey): void {
$changeKeyStorageRoot = $this->getMockBuilder('OC\Core\Command\Encryption\ChangeKeyStorageRoot')
->setConstructorArgs(
@@ -135,7 +133,7 @@ class ChangeKeyStorageRootTest extends TestCase {
}
public function testMoveAllKeys(): void {
- /** @var \OC\Core\Command\Encryption\ChangeKeyStorageRoot $changeKeyStorageRoot */
+ /** @var ChangeKeyStorageRoot $changeKeyStorageRoot */
$changeKeyStorageRoot = $this->getMockBuilder('OC\Core\Command\Encryption\ChangeKeyStorageRoot')
->setConstructorArgs(
[
@@ -166,11 +164,11 @@ class ChangeKeyStorageRootTest extends TestCase {
}
/**
- * @dataProvider dataTestPrepareNewRootException
*
* @param bool $dirExists
* @param bool $couldCreateFile
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestPrepareNewRootException')]
public function testPrepareNewRootException($dirExists, $couldCreateFile): void {
$this->expectException(\Exception::class);
@@ -190,12 +188,12 @@ class ChangeKeyStorageRootTest extends TestCase {
}
/**
- * @dataProvider dataTestMoveSystemKeys
*
* @param bool $dirExists
* @param bool $targetExists
* @param bool $executeRename
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestMoveSystemKeys')]
public function testMoveSystemKeys($dirExists, $targetExists, $executeRename): void {
$changeKeyStorageRoot = $this->getMockBuilder('OC\Core\Command\Encryption\ChangeKeyStorageRoot')
->setConstructorArgs(
@@ -256,13 +254,13 @@ class ChangeKeyStorageRootTest extends TestCase {
}
/**
- * @dataProvider dataTestMoveUserEncryptionFolder
*
* @param bool $userExists
* @param bool $isDir
* @param bool $targetExists
* @param bool $shouldRename
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestMoveUserEncryptionFolder')]
public function testMoveUserEncryptionFolder($userExists, $isDir, $targetExists, $shouldRename): void {
$changeKeyStorageRoot = $this->getMockBuilder('OC\Core\Command\Encryption\ChangeKeyStorageRoot')
->setConstructorArgs(
@@ -308,9 +306,7 @@ class ChangeKeyStorageRootTest extends TestCase {
}
- /**
- * @dataProvider dataTestPrepareParentFolder
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestPrepareParentFolder')]
public function testPrepareParentFolder($path, $pathExists): void {
$this->view->expects($this->any())->method('file_exists')
->willReturnCallback(
diff --git a/tests/Core/Command/Encryption/DecryptAllTest.php b/tests/Core/Command/Encryption/DecryptAllTest.php
index ccf4e3209ce..41d9e4c713f 100644
--- a/tests/Core/Command/Encryption/DecryptAllTest.php
+++ b/tests/Core/Command/Encryption/DecryptAllTest.php
@@ -18,13 +18,13 @@ use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
class DecryptAllTest extends TestCase {
- /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\IConfig */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|IConfig */
protected $config;
/** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\Encryption\IManager */
protected $encryptionManager;
- /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\App\IAppManager */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|IAppManager */
protected $appManager;
/** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Input\InputInterface */
@@ -110,9 +110,7 @@ class DecryptAllTest extends TestCase {
$this->invokePrivate($instance, 'resetMaintenanceAndTrashbin');
}
- /**
- * @dataProvider dataTestExecute
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestExecute')]
public function testExecute($encryptionEnabled, $continue): void {
$instance = new DecryptAll(
$this->encryptionManager,
diff --git a/tests/Core/Command/Encryption/DisableTest.php b/tests/Core/Command/Encryption/DisableTest.php
index d4ea8e5c7dc..a89fd636e47 100644
--- a/tests/Core/Command/Encryption/DisableTest.php
+++ b/tests/Core/Command/Encryption/DisableTest.php
@@ -34,7 +34,7 @@ class DisableTest extends TestCase {
$this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
$this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
- /** @var \OCP\IConfig $config */
+ /** @var IConfig $config */
$this->command = new Disable($config);
}
@@ -47,12 +47,12 @@ class DisableTest extends TestCase {
}
/**
- * @dataProvider dataDisable
*
* @param string $oldStatus
* @param bool $isUpdating
* @param string $expectedString
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataDisable')]
public function testDisable($oldStatus, $isUpdating, $expectedString): void {
$this->config->expects($this->once())
->method('getAppValue')
diff --git a/tests/Core/Command/Encryption/EnableTest.php b/tests/Core/Command/Encryption/EnableTest.php
index b90ad14c893..32d1a7576f5 100644
--- a/tests/Core/Command/Encryption/EnableTest.php
+++ b/tests/Core/Command/Encryption/EnableTest.php
@@ -56,9 +56,7 @@ class EnableTest extends TestCase {
];
}
- /**
- * @dataProvider dataEnable
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataEnable')]
public function testEnable(string $oldStatus, ?string $defaultModule, array $availableModules, bool $isUpdating, string $expectedString, string $expectedDefaultModuleString): void {
if ($isUpdating) {
$this->config->expects($this->once())
diff --git a/tests/Core/Command/Encryption/EncryptAllTest.php b/tests/Core/Command/Encryption/EncryptAllTest.php
index e40b5d11c1b..6332c936a98 100644
--- a/tests/Core/Command/Encryption/EncryptAllTest.php
+++ b/tests/Core/Command/Encryption/EncryptAllTest.php
@@ -19,13 +19,13 @@ use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
class EncryptAllTest extends TestCase {
- /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\IConfig */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|IConfig */
protected $config;
/** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\Encryption\IManager */
protected $encryptionManager;
- /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\App\IAppManager */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|IAppManager */
protected $appManager;
/** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Input\InputInterface */
@@ -37,7 +37,7 @@ class EncryptAllTest extends TestCase {
/** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Helper\QuestionHelper */
protected $questionHelper;
- /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\Encryption\IEncryptionModule */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|IEncryptionModule */
protected $encryptionModule;
/** @var EncryptAll */
@@ -78,9 +78,7 @@ class EncryptAllTest extends TestCase {
$this->invokePrivate($instance, 'resetMaintenanceAndTrashbin');
}
- /**
- * @dataProvider dataTestExecute
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestExecute')]
public function testExecute($answer, $askResult): void {
$command = new EncryptAll($this->encryptionManager, $this->appManager, $this->config, $this->questionHelper);
diff --git a/tests/Core/Command/Encryption/SetDefaultModuleTest.php b/tests/Core/Command/Encryption/SetDefaultModuleTest.php
index eb6baa0185f..df38d730db3 100644
--- a/tests/Core/Command/Encryption/SetDefaultModuleTest.php
+++ b/tests/Core/Command/Encryption/SetDefaultModuleTest.php
@@ -53,7 +53,6 @@ class SetDefaultModuleTest extends TestCase {
}
/**
- * @dataProvider dataSetDefaultModule
*
* @param string $oldModule
* @param string $newModule
@@ -61,6 +60,7 @@ class SetDefaultModuleTest extends TestCase {
* @param bool $updateSuccess
* @param string $expectedString
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetDefaultModule')]
public function testSetDefaultModule($oldModule, $newModule, $updateModule, $updateSuccess, $expectedString): void {
$this->consoleInput->expects($this->once())
->method('getArgument')
@@ -91,7 +91,6 @@ class SetDefaultModuleTest extends TestCase {
}
/**
- * @dataProvider dataSetDefaultModule
*
* @param string $oldModule
* @param string $newModule
@@ -99,6 +98,7 @@ class SetDefaultModuleTest extends TestCase {
* @param bool $updateSuccess
* @param string $expectedString
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetDefaultModule')]
public function testMaintenanceMode($oldModule, $newModule, $updateModule, $updateSuccess, $expectedString): void {
$this->consoleInput->expects($this->never())
->method('getArgument')
diff --git a/tests/Core/Command/Log/FileTest.php b/tests/Core/Command/Log/FileTest.php
index e75cf75b927..1aaf398b875 100644
--- a/tests/Core/Command/Log/FileTest.php
+++ b/tests/Core/Command/Log/FileTest.php
@@ -72,9 +72,7 @@ class FileTest extends TestCase {
];
}
- /**
- * @dataProvider changeRotateSizeProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('changeRotateSizeProvider')]
public function testChangeRotateSize($optionValue, $configValue): void {
$this->config->method('getSystemValue')->willReturnArgument(1);
$this->consoleInput->method('getOption')
diff --git a/tests/Core/Command/Log/ManageTest.php b/tests/Core/Command/Log/ManageTest.php
index d8714eb88d4..8b307048719 100644
--- a/tests/Core/Command/Log/ManageTest.php
+++ b/tests/Core/Command/Log/ManageTest.php
@@ -100,9 +100,7 @@ class ManageTest extends TestCase {
];
}
- /**
- * @dataProvider dataConvertLevelString
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataConvertLevelString')]
public function testConvertLevelString(string $levelString, int $expectedInt): void {
$this->assertEquals($expectedInt,
self::invokePrivate($this->command, 'convertLevelString', [$levelString])
@@ -126,9 +124,7 @@ class ManageTest extends TestCase {
];
}
- /**
- * @dataProvider dataConvertLevelNumber
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataConvertLevelNumber')]
public function testConvertLevelNumber(int $levelNum, string $expectedString): void {
$this->assertEquals($expectedString,
self::invokePrivate($this->command, 'convertLevelNumber', [$levelNum])
diff --git a/tests/Core/Command/Maintenance/DataFingerprintTest.php b/tests/Core/Command/Maintenance/DataFingerprintTest.php
index 31c90b7aea2..99004a7a5f5 100644
--- a/tests/Core/Command/Maintenance/DataFingerprintTest.php
+++ b/tests/Core/Command/Maintenance/DataFingerprintTest.php
@@ -36,7 +36,7 @@ class DataFingerprintTest extends TestCase {
$this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
$this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
- /** @var \OCP\IConfig $config */
+ /** @var IConfig $config */
$this->command = new DataFingerprint($this->config, $this->timeFactory);
}
diff --git a/tests/Core/Command/Maintenance/ModeTest.php b/tests/Core/Command/Maintenance/ModeTest.php
index 2aeca27f503..5a9a90b0197 100644
--- a/tests/Core/Command/Maintenance/ModeTest.php
+++ b/tests/Core/Command/Maintenance/ModeTest.php
@@ -112,7 +112,6 @@ class ModeTest extends TestCase {
/**
* Asserts that execute works as expected.
*
- * @dataProvider getExecuteTestData
* @param string $option The command option.
* @param bool $currentMaintenanceState The current maintenance state.
* @param null|bool $expectedMaintenanceState
@@ -120,6 +119,7 @@ class ModeTest extends TestCase {
* @param string $expectedOutput The expected command output.
* @throws \Exception
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('getExecuteTestData')]
public function testExecute(
string $option,
bool $currentMaintenanceState,
diff --git a/tests/Core/Command/Preview/CleanupTest.php b/tests/Core/Command/Preview/CleanupTest.php
index 5549fcf6d44..e4a83246e5b 100644
--- a/tests/Core/Command/Preview/CleanupTest.php
+++ b/tests/Core/Command/Preview/CleanupTest.php
@@ -100,9 +100,7 @@ class CleanupTest extends TestCase {
$this->assertEquals(1, $this->repair->run($this->input, $this->output));
}
- /**
- * @dataProvider dataForTestCleanupWithDeleteException
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataForTestCleanupWithDeleteException')]
public function testCleanupWithDeleteException(string $exceptionClass, string $errorMessage): void {
$previewFolder = $this->createMock(Folder::class);
$previewFolder->expects($this->once())
diff --git a/tests/Core/Command/Preview/RepairTest.php b/tests/Core/Command/Preview/RepairTest.php
index 167a29f44ae..9b9cde6dd95 100644
--- a/tests/Core/Command/Preview/RepairTest.php
+++ b/tests/Core/Command/Preview/RepairTest.php
@@ -111,9 +111,7 @@ class RepairTest extends TestCase {
];
}
- /**
- * @dataProvider dataEmptyTest
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataEmptyTest')]
public function testEmptyExecute($directoryNames, $expectedOutput): void {
$previewFolder = $this->getMockBuilder(Folder::class)
->getMock();
diff --git a/tests/Core/Command/User/AddTest.php b/tests/Core/Command/User/AddTest.php
index c9137bfc01c..5a8bc3abea1 100644
--- a/tests/Core/Command/User/AddTest.php
+++ b/tests/Core/Command/User/AddTest.php
@@ -84,9 +84,7 @@ class AddTest extends TestCase {
);
}
- /**
- * @dataProvider addEmailDataProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('addEmailDataProvider')]
public function testAddEmail(
?string $email,
bool $isEmailValid,
diff --git a/tests/Core/Command/User/DeleteTest.php b/tests/Core/Command/User/DeleteTest.php
index 424b1ebf3d3..4e06b0f91fc 100644
--- a/tests/Core/Command/User/DeleteTest.php
+++ b/tests/Core/Command/User/DeleteTest.php
@@ -35,7 +35,7 @@ class DeleteTest extends TestCase {
$this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
$this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
- /** @var \OCP\IUserManager $userManager */
+ /** @var IUserManager $userManager */
$this->command = new Delete($userManager);
}
@@ -48,11 +48,11 @@ class DeleteTest extends TestCase {
}
/**
- * @dataProvider validUserLastSeen
*
* @param bool $deleteSuccess
* @param string $expectedString
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('validUserLastSeen')]
public function testValidUser($deleteSuccess, $expectedString): void {
$user = $this->getMockBuilder(IUser::class)->getMock();
$user->expects($this->once())
diff --git a/tests/Core/Command/User/LastSeenTest.php b/tests/Core/Command/User/LastSeenTest.php
index 3b486f2f4c8..64c710eacc5 100644
--- a/tests/Core/Command/User/LastSeenTest.php
+++ b/tests/Core/Command/User/LastSeenTest.php
@@ -35,7 +35,7 @@ class LastSeenTest extends TestCase {
$this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
$this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
- /** @var \OCP\IUserManager $userManager */
+ /** @var IUserManager $userManager */
$this->command = new LastSeen($userManager);
}
@@ -47,11 +47,11 @@ class LastSeenTest extends TestCase {
}
/**
- * @dataProvider validUserLastSeen
*
* @param int $lastSeen
* @param string $expectedString
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('validUserLastSeen')]
public function testValidUser($lastSeen, $expectedString): void {
$user = $this->getMockBuilder(IUser::class)->getMock();
$user->expects($this->once())
diff --git a/tests/Core/Command/User/ProfileTest.php b/tests/Core/Command/User/ProfileTest.php
index 2e3227ab56b..ff5568bacfc 100644
--- a/tests/Core/Command/User/ProfileTest.php
+++ b/tests/Core/Command/User/ProfileTest.php
@@ -166,9 +166,7 @@ class ProfileTest extends TestCase {
];
}
- /**
- * @dataProvider dataCheckInput
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataCheckInput')]
public function testCheckInput(array $arguments, array $options, array $parameterOptions, bool $existingUser, ?string $expectedException): void {
$this->consoleInput->expects($this->any())
->method('getArgument')
@@ -233,9 +231,8 @@ class ProfileTest extends TestCase {
/**
* Tests the deletion mechanism on profile settings.
- *
- * @dataProvider dataExecuteDeleteProfileProperty
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataExecuteDeleteProfileProperty')]
public function testExecuteDeleteProfileProperty(string $configKey, string $value, bool $errorIfNotExists, ?string $expectedLine, int $expectedReturn): void {
$uid = 'username';
$appName = 'profile';
@@ -327,9 +324,7 @@ class ProfileTest extends TestCase {
];
}
- /**
- * @dataProvider dataExecuteGet
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataExecuteGet')]
public function testExecuteGet(string $key, string $value, ?string $defaultValue, string $expectedLine, int $expectedReturn): void {
$command = $this->getCommand([
'writeArrayInOutputFormat',
diff --git a/tests/Core/Command/User/SettingTest.php b/tests/Core/Command/User/SettingTest.php
index 80993a82bf1..706e5b24742 100644
--- a/tests/Core/Command/User/SettingTest.php
+++ b/tests/Core/Command/User/SettingTest.php
@@ -164,7 +164,6 @@ class SettingTest extends TestCase {
}
/**
- * @dataProvider dataCheckInput
*
* @param array $arguments
* @param array $options
@@ -172,6 +171,7 @@ class SettingTest extends TestCase {
* @param mixed $user
* @param string $expectedException
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataCheckInput')]
public function testCheckInput($arguments, $options, $parameterOptions, $user, $expectedException): void {
$this->consoleInput->expects($this->any())
->method('getArgument')
@@ -233,13 +233,13 @@ class SettingTest extends TestCase {
}
/**
- * @dataProvider dataExecuteDelete
*
* @param string|null $value
* @param bool $errorIfNotExists
* @param string $expectedLine
* @param int $expectedReturn
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataExecuteDelete')]
public function testExecuteDelete($value, $errorIfNotExists, $expectedLine, $expectedReturn): void {
$command = $this->getCommand([
'writeArrayInOutputFormat',
@@ -297,13 +297,13 @@ class SettingTest extends TestCase {
}
/**
- * @dataProvider dataExecuteSet
*
* @param string|null $value
* @param bool $updateOnly
* @param string $expectedLine
* @param int $expectedReturn
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataExecuteSet')]
public function testExecuteSet($value, $updateOnly, $expectedLine, $expectedReturn): void {
$command = $this->getCommand([
'writeArrayInOutputFormat',
@@ -364,13 +364,13 @@ class SettingTest extends TestCase {
}
/**
- * @dataProvider dataExecuteGet
*
* @param string|null $value
* @param string|null $defaultValue
* @param string $expectedLine
* @param int $expectedReturn
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataExecuteGet')]
public function testExecuteGet($value, $defaultValue, $expectedLine, $expectedReturn): void {
$command = $this->getCommand([
'writeArrayInOutputFormat',
diff --git a/tests/Core/Controller/AutoCompleteControllerTest.php b/tests/Core/Controller/AutoCompleteControllerTest.php
index 4af1feafad9..c5574f78fc1 100644
--- a/tests/Core/Controller/AutoCompleteControllerTest.php
+++ b/tests/Core/Controller/AutoCompleteControllerTest.php
@@ -154,9 +154,7 @@ class AutoCompleteControllerTest extends TestCase {
];
}
- /**
- * @dataProvider searchDataProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('searchDataProvider')]
public function testGet(array $searchResults, array $expected, string $searchTerm, ?string $itemType, ?string $itemId, ?string $sorter): void {
$this->collaboratorSearch->expects($this->once())
->method('search')
diff --git a/tests/Core/Controller/ClientFlowLoginControllerTest.php b/tests/Core/Controller/ClientFlowLoginControllerTest.php
index 597c6641706..b182bb1bb39 100644
--- a/tests/Core/Controller/ClientFlowLoginControllerTest.php
+++ b/tests/Core/Controller/ClientFlowLoginControllerTest.php
@@ -603,11 +603,11 @@ class ClientFlowLoginControllerTest extends TestCase {
}
/**
- * @dataProvider dataGeneratePasswordWithHttpsProxy
* @param array $headers
* @param string $protocol
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGeneratePasswordWithHttpsProxy')]
public function testGeneratePasswordWithHttpsProxy(array $headers, $protocol, $expected): void {
$this->session
->expects($this->once())
diff --git a/tests/Core/Controller/GuestAvatarControllerTest.php b/tests/Core/Controller/GuestAvatarControllerTest.php
index 3e66cc8bad2..66a83098130 100644
--- a/tests/Core/Controller/GuestAvatarControllerTest.php
+++ b/tests/Core/Controller/GuestAvatarControllerTest.php
@@ -8,6 +8,7 @@ namespace Core\Controller;
use OC\Core\Controller\GuestAvatarController;
use OCP\AppFramework\Http\FileDisplayResponse;
+use OCP\Files\File;
use OCP\Files\SimpleFS\ISimpleFile;
use OCP\IAvatar;
use OCP\IAvatarManager;
@@ -39,7 +40,7 @@ class GuestAvatarControllerTest extends \Test\TestCase {
private $avatar;
/**
- * @var \OCP\Files\File|\PHPUnit\Framework\MockObject\MockObject
+ * @var File|\PHPUnit\Framework\MockObject\MockObject
*/
private $file;
diff --git a/tests/Core/Controller/LoginControllerTest.php b/tests/Core/Controller/LoginControllerTest.php
index 6dcf4771f7e..18baaf5b08c 100644
--- a/tests/Core/Controller/LoginControllerTest.php
+++ b/tests/Core/Controller/LoginControllerTest.php
@@ -351,9 +351,7 @@ class LoginControllerTest extends TestCase {
];
}
- /**
- * @dataProvider passwordResetDataProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('passwordResetDataProvider')]
public function testShowLoginFormWithPasswordResetOption($canChangePassword,
$expectedResult): void {
$this->userSession
diff --git a/tests/Core/Controller/LostControllerTest.php b/tests/Core/Controller/LostControllerTest.php
index 84b6fb78a8f..bbb5f2c2e54 100644
--- a/tests/Core/Controller/LostControllerTest.php
+++ b/tests/Core/Controller/LostControllerTest.php
@@ -687,10 +687,10 @@ class LostControllerTest extends TestCase {
}
/**
- * @dataProvider dataTwoUsersWithSameEmailOneDisabled
* @param bool $userEnabled1
* @param bool $userEnabled2
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTwoUsersWithSameEmailOneDisabled')]
public function testTwoUsersWithSameEmailOneDisabled(bool $userEnabled1, bool $userEnabled2): void {
$user1 = $this->createMock(IUser::class);
$user1->method('getEMailAddress')
diff --git a/tests/Core/Controller/NavigationControllerTest.php b/tests/Core/Controller/NavigationControllerTest.php
index f7ce5bedef7..d00976f18ec 100644
--- a/tests/Core/Controller/NavigationControllerTest.php
+++ b/tests/Core/Controller/NavigationControllerTest.php
@@ -48,7 +48,7 @@ class NavigationControllerTest extends TestCase {
[true],
];
}
- /** @dataProvider dataGetNavigation */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetNavigation')]
public function testGetAppNavigation(bool $absolute): void {
$this->navigationManager->expects($this->once())
->method('getAll')
@@ -76,7 +76,7 @@ class NavigationControllerTest extends TestCase {
}
}
- /** @dataProvider dataGetNavigation */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetNavigation')]
public function testGetSettingsNavigation(bool $absolute): void {
$this->navigationManager->expects($this->once())
->method('getAll')
diff --git a/tests/Core/Controller/WipeControllerTest.php b/tests/Core/Controller/WipeControllerTest.php
index fa5f98988e7..5330eb599e6 100644
--- a/tests/Core/Controller/WipeControllerTest.php
+++ b/tests/Core/Controller/WipeControllerTest.php
@@ -47,9 +47,8 @@ class WipeControllerTest extends TestCase {
* @param bool $valid
* @param bool $couldPerform
* @param bool $result
- *
- * @dataProvider dataTest
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTest')]
public function testCheckWipe(bool $valid, bool $couldPerform, bool $result): void {
if (!$valid) {
$this->remoteWipe->method('start')
@@ -76,9 +75,8 @@ class WipeControllerTest extends TestCase {
* @param bool $valid
* @param bool $couldPerform
* @param bool $result
- *
- * @dataProvider dataTest
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTest')]
public function testWipeDone(bool $valid, bool $couldPerform, bool $result): void {
if (!$valid) {
$this->remoteWipe->method('finish')
diff --git a/tests/Core/Data/LoginFlowV2CredentialsTest.php b/tests/Core/Data/LoginFlowV2CredentialsTest.php
index bad36610678..ffa06f1a451 100644
--- a/tests/Core/Data/LoginFlowV2CredentialsTest.php
+++ b/tests/Core/Data/LoginFlowV2CredentialsTest.php
@@ -12,7 +12,7 @@ use OC\Core\Data\LoginFlowV2Credentials;
use Test\TestCase;
class LoginFlowV2CredentialsTest extends TestCase {
- /** @var \OC\Core\Data\LoginFlowV2Credentials */
+ /** @var LoginFlowV2Credentials */
private $fixture;
public function setUp(): void {
diff --git a/tests/Core/Middleware/TwoFactorMiddlewareTest.php b/tests/Core/Middleware/TwoFactorMiddlewareTest.php
index 2d778a740dc..10afdd7c5e1 100644
--- a/tests/Core/Middleware/TwoFactorMiddlewareTest.php
+++ b/tests/Core/Middleware/TwoFactorMiddlewareTest.php
@@ -243,9 +243,7 @@ class TwoFactorMiddlewareTest extends TestCase {
];
}
- /**
- * @dataProvider dataRequires2FASetupDone
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataRequires2FASetupDone')]
public function testRequires2FASetupDone(bool $hasProvider, bool $missingProviders, bool $expectEception): void {
if ($hasProvider) {
$provider = $this->createMock(IProvider::class);
diff --git a/tests/Core/Service/LoginFlowV2ServiceUnitTest.php b/tests/Core/Service/LoginFlowV2ServiceUnitTest.php
index b2c6f5c3027..5d05a1c6e0a 100644
--- a/tests/Core/Service/LoginFlowV2ServiceUnitTest.php
+++ b/tests/Core/Service/LoginFlowV2ServiceUnitTest.php
@@ -31,25 +31,25 @@ use Test\TestCase;
* Unit tests for \OC\Core\Service\LoginFlowV2Service
*/
class LoginFlowV2ServiceUnitTest extends TestCase {
- /** @var \OCP\IConfig */
+ /** @var IConfig */
private $config;
- /** @var \OCP\Security\ICrypto */
+ /** @var ICrypto */
private $crypto;
/** @var LoggerInterface|MockObject */
private $logger;
- /** @var \OC\Core\Db\LoginFlowV2Mapper */
+ /** @var LoginFlowV2Mapper */
private $mapper;
- /** @var \OCP\Security\ISecureRandom */
+ /** @var ISecureRandom */
private $secureRandom;
- /** @var \OC\Core\Service\LoginFlowV2Service */
+ /** @var LoginFlowV2Service */
private $subjectUnderTest;
- /** @var \OCP\AppFramework\Utility\ITimeFactory */
+ /** @var ITimeFactory */
private $timeFactory;
/** @var \OC\Authentication\Token\IProvider */
diff --git a/tests/lib/Accounts/AccountManagerTest.php b/tests/lib/Accounts/AccountManagerTest.php
index 6e2f30a2c26..2e1dc4ec70c 100644
--- a/tests/lib/Accounts/AccountManagerTest.php
+++ b/tests/lib/Accounts/AccountManagerTest.php
@@ -462,10 +462,7 @@ class AccountManagerTest extends TestCase {
->getMock();
}
- /**
- * @dataProvider dataTrueFalse
- *
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTrueFalse')]
public function testUpdateUser(array $newData, array $oldData, bool $insertNew, bool $updateExisting): void {
$accountManager = $this->getInstance(['getUser', 'insertNewUser', 'updateExistingUser']);
/** @var IUser $user */
@@ -684,9 +681,7 @@ class AccountManagerTest extends TestCase {
];
}
- /**
- * @dataProvider dataParsePhoneNumber
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataParsePhoneNumber')]
public function testSanitizePhoneNumberOnUpdateAccount(string $phoneInput, string $defaultRegion, ?string $phoneNumber): void {
$this->config->method('getSystemValueString')
->willReturn($defaultRegion);
@@ -738,9 +733,7 @@ class AccountManagerTest extends TestCase {
];
}
- /**
- * @dataProvider dataSanitizeOnUpdate
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSanitizeOnUpdate')]
public function testSanitizingOnUpdateAccount(string $property, string $input, ?string $output): void {
if ($property === IAccountManager::PROPERTY_FEDIVERSE) {
@@ -823,9 +816,7 @@ class AccountManagerTest extends TestCase {
];
}
- /**
- * @dataProvider dataSanitizeFediverseServer
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSanitizeFediverseServer')]
public function testSanitizingFediverseServer(string $input, ?string $output, bool $hasInternet, ?string $serverResponse): void {
$this->config->expects(self::once())
->method('getSystemValueBool')
@@ -882,9 +873,7 @@ class AccountManagerTest extends TestCase {
}
}
- /**
- * @dataProvider searchDataProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('searchDataProvider')]
public function testSearchUsers(string $property, array $values, array $expected): void {
$this->populateOrUpdate();
@@ -960,9 +949,7 @@ class AccountManagerTest extends TestCase {
];
}
- /**
- * @dataProvider dataCheckEmailVerification
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataCheckEmailVerification')]
public function testCheckEmailVerification(array $userData, ?string $newEmail): void {
$user = $this->makeUser(...$userData);
// Once because of getAccount, once because of getUser
@@ -1027,9 +1014,7 @@ class AccountManagerTest extends TestCase {
];
}
- /**
- * @dataProvider dataSetDefaultPropertyScopes
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetDefaultPropertyScopes')]
public function testSetDefaultPropertyScopes(array $propertyScopes, array $expectedResultScopes): void {
$user = $this->makeUser('steve', 'Steve Smith', 'steve@steve.steve');
$this->config->expects($this->once())->method('getSystemValue')->with('account_manager.default_property_scope', [])->willReturn($propertyScopes);
diff --git a/tests/lib/Accounts/AccountPropertyTest.php b/tests/lib/Accounts/AccountPropertyTest.php
index 940a71027fe..b92e45176a3 100644
--- a/tests/lib/Accounts/AccountPropertyTest.php
+++ b/tests/lib/Accounts/AccountPropertyTest.php
@@ -70,9 +70,7 @@ class AccountPropertyTest extends TestCase {
];
}
- /**
- * @dataProvider scopesProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('scopesProvider')]
public function testSetScopeMapping(string $storedScope, ?string $returnedScope): void {
if ($returnedScope === null) {
$this->expectException(\InvalidArgumentException::class);
diff --git a/tests/lib/Accounts/HooksTest.php b/tests/lib/Accounts/HooksTest.php
index 9fe7e7b4997..622fb3c7461 100644
--- a/tests/lib/Accounts/HooksTest.php
+++ b/tests/lib/Accounts/HooksTest.php
@@ -44,7 +44,6 @@ class HooksTest extends TestCase {
}
/**
- * @dataProvider dataTestChangeUserHook
*
* @param $params
* @param $data
@@ -52,6 +51,7 @@ class HooksTest extends TestCase {
* @param $setDisplayName
* @param $error
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestChangeUserHook')]
public function testChangeUserHook($params, $data, $setEmail, $setDisplayName, $error): void {
if ($error) {
$this->accountManager->expects($this->never())->method('updateAccount');
diff --git a/tests/lib/Activity/ManagerTest.php b/tests/lib/Activity/ManagerTest.php
index e895991bac7..db0bedce359 100644
--- a/tests/lib/Activity/ManagerTest.php
+++ b/tests/lib/Activity/ManagerTest.php
@@ -88,11 +88,11 @@ class ManagerTest extends TestCase {
}
/**
- * @dataProvider getUserFromTokenThrowInvalidTokenData
*
* @param string $token
* @param array $users
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('getUserFromTokenThrowInvalidTokenData')]
public function testGetUserFromTokenThrowInvalidToken($token, $users): void {
$this->expectException(\UnexpectedValueException::class);
@@ -109,12 +109,12 @@ class ManagerTest extends TestCase {
}
/**
- * @dataProvider getUserFromTokenData
*
* @param string $userLoggedIn
* @param string $token
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('getUserFromTokenData')]
public function testGetUserFromToken($userLoggedIn, $token, $expected): void {
if ($userLoggedIn !== null) {
$this->mockUserSession($userLoggedIn);
@@ -200,10 +200,10 @@ class ManagerTest extends TestCase {
}
/**
- * @dataProvider dataPublish
* @param string|null $author
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataPublish')]
public function testPublish($author, $expected): void {
if ($author !== null) {
$authorObject = $this->getMockBuilder(IUser::class)
diff --git a/tests/lib/AllConfigTest.php b/tests/lib/AllConfigTest.php
index 6c3704bed3b..80a38d590f4 100644
--- a/tests/lib/AllConfigTest.php
+++ b/tests/lib/AllConfigTest.php
@@ -22,7 +22,7 @@ use OCP\PreConditionNotMetException;
use OCP\Server;
class AllConfigTest extends \Test\TestCase {
- /** @var \OCP\IDBConnection */
+ /** @var IDBConnection */
protected $connection;
protected function getConfig($systemConfig = null, $connection = null) {
@@ -159,9 +159,9 @@ class AllConfigTest extends \Test\TestCase {
}
/**
- * @dataProvider dataSetUserValueUnexpectedValue
* @param mixed $value
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetUserValueUnexpectedValue')]
public function testSetUserValueUnexpectedValue($value): void {
$this->expectException(\UnexpectedValueException::class);
diff --git a/tests/lib/App/AppManagerTest.php b/tests/lib/App/AppManagerTest.php
index 5cd141c16a9..6637c529a1e 100644
--- a/tests/lib/App/AppManagerTest.php
+++ b/tests/lib/App/AppManagerTest.php
@@ -139,9 +139,7 @@ class AppManagerTest extends TestCase {
);
}
- /**
- * @dataProvider dataGetAppIcon
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetAppIcon')]
public function testGetAppIcon($callback, ?bool $dark, ?string $expected): void {
$this->urlGenerator->expects($this->atLeastOnce())
->method('imagePath')
@@ -310,10 +308,9 @@ class AppManagerTest extends TestCase {
}
/**
- * @dataProvider dataEnableAppForGroupsAllowedTypes
- *
* @param array $appInfo
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataEnableAppForGroupsAllowedTypes')]
public function testEnableAppForGroupsAllowedTypes(array $appInfo): void {
$group1 = $this->createMock(IGroup::class);
$group1->method('getGID')
@@ -369,11 +366,11 @@ class AppManagerTest extends TestCase {
}
/**
- * @dataProvider dataEnableAppForGroupsForbiddenTypes
*
* @param string $type
*
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataEnableAppForGroupsForbiddenTypes')]
public function testEnableAppForGroupsForbiddenTypes($type): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('test can\'t be enabled for groups.');
@@ -776,9 +773,7 @@ class AppManagerTest extends TestCase {
];
}
- /**
- * @dataProvider isBackendRequiredDataProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('isBackendRequiredDataProvider')]
public function testIsBackendRequired(
string $backend,
array $appBackends,
diff --git a/tests/lib/App/AppStore/Fetcher/AppDiscoverFetcherTest.php b/tests/lib/App/AppStore/Fetcher/AppDiscoverFetcherTest.php
index 54de828c907..b9866396662 100644
--- a/tests/lib/App/AppStore/Fetcher/AppDiscoverFetcherTest.php
+++ b/tests/lib/App/AppStore/Fetcher/AppDiscoverFetcherTest.php
@@ -72,9 +72,7 @@ class AppDiscoverFetcherTest extends FetcherBase {
$this->assertEquals([], $this->fetcher->get());
}
- /**
- * @dataProvider dataGetETag
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetETag')]
public function testGetEtag(?string $expected, bool $throws, string $content = ''): void {
$folder = $this->createMock(ISimpleFolder::class);
if (!$throws) {
diff --git a/tests/lib/App/AppStore/Version/VersionParserTest.php b/tests/lib/App/AppStore/Version/VersionParserTest.php
index d46b107748b..3ccc68bc076 100644
--- a/tests/lib/App/AppStore/Version/VersionParserTest.php
+++ b/tests/lib/App/AppStore/Version/VersionParserTest.php
@@ -57,11 +57,11 @@ class VersionParserTest extends TestCase {
}
/**
- * @dataProvider versionProvider
*
* @param string $input
* @param Version $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('versionProvider')]
public function testGetVersion($input,
Version $expected): void {
$this->assertEquals($expected, $this->versionParser->getVersion($input));
diff --git a/tests/lib/App/CompareVersionTest.php b/tests/lib/App/CompareVersionTest.php
index f357e47d670..3c8295f0ed7 100644
--- a/tests/lib/App/CompareVersionTest.php
+++ b/tests/lib/App/CompareVersionTest.php
@@ -54,9 +54,7 @@ class CompareVersionTest extends TestCase {
];
}
- /**
- * @dataProvider comparisonData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('comparisonData')]
public function testComparison(string $actualVersion, string $requiredVersion,
string $comparator, bool $expected): void {
$isCompatible = $this->compare->isCompatible($actualVersion, $requiredVersion,
diff --git a/tests/lib/App/DependencyAnalyzerTest.php b/tests/lib/App/DependencyAnalyzerTest.php
index a304b0935b7..db53d678881 100644
--- a/tests/lib/App/DependencyAnalyzerTest.php
+++ b/tests/lib/App/DependencyAnalyzerTest.php
@@ -68,13 +68,13 @@ class DependencyAnalyzerTest extends TestCase {
}
/**
- * @dataProvider providesPhpVersion
*
* @param string $expectedMissing
* @param string $minVersion
* @param string $maxVersion
* @param string $intSize
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providesPhpVersion')]
public function testPhpVersion($expectedMissing, $minVersion, $maxVersion, $intSize): void {
$app = [
'dependencies' => [
@@ -97,10 +97,10 @@ class DependencyAnalyzerTest extends TestCase {
}
/**
- * @dataProvider providesDatabases
* @param $expectedMissing
* @param $databases
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providesDatabases')]
public function testDatabases($expectedMissing, $databases): void {
$app = [
'dependencies' => [
@@ -116,11 +116,11 @@ class DependencyAnalyzerTest extends TestCase {
}
/**
- * @dataProvider providesCommands
*
* @param string $expectedMissing
* @param string|null $commands
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providesCommands')]
public function testCommand($expectedMissing, $commands): void {
$app = [
'dependencies' => [
@@ -136,10 +136,10 @@ class DependencyAnalyzerTest extends TestCase {
}
/**
- * @dataProvider providesLibs
* @param $expectedMissing
* @param $libs
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providesLibs')]
public function testLibs($expectedMissing, $libs): void {
$app = [
'dependencies' => [
@@ -156,10 +156,10 @@ class DependencyAnalyzerTest extends TestCase {
}
/**
- * @dataProvider providesOS
* @param $expectedMissing
* @param $oss
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providesOS')]
public function testOS($expectedMissing, $oss): void {
$app = [
'dependencies' => []
@@ -175,10 +175,10 @@ class DependencyAnalyzerTest extends TestCase {
}
/**
- * @dataProvider providesOC
* @param $expectedMissing
* @param $oc
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providesOC')]
public function testOC($expectedMissing, $oc): void {
$app = [
'dependencies' => []
diff --git a/tests/lib/App/InfoParserTest.php b/tests/lib/App/InfoParserTest.php
index 028c98eca87..f7c6a2eb7bd 100644
--- a/tests/lib/App/InfoParserTest.php
+++ b/tests/lib/App/InfoParserTest.php
@@ -13,7 +13,7 @@ use OCP\Cache\CappedMemoryCache;
use Test\TestCase;
class InfoParserTest extends TestCase {
- /** @var OCP\Cache\CappedMemoryCache */
+ /** @var CappedMemoryCache */
private static $cache;
public static function setUpBeforeClass(): void {
@@ -32,16 +32,12 @@ class InfoParserTest extends TestCase {
$this->assertEquals($expectedData, $data);
}
- /**
- * @dataProvider providesInfoXml
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providesInfoXml')]
public function testParsingValidXmlWithoutCache($expectedJson, $xmlFile): void {
$this->parserTest($expectedJson, $xmlFile);
}
- /**
- * @dataProvider providesInfoXml
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providesInfoXml')]
public function testParsingValidXmlWithCache($expectedJson, $xmlFile): void {
$this->parserTest($expectedJson, $xmlFile, self::$cache);
}
diff --git a/tests/lib/App/PlatformRepositoryTest.php b/tests/lib/App/PlatformRepositoryTest.php
index 83947cf7197..bc0ecb97c5a 100644
--- a/tests/lib/App/PlatformRepositoryTest.php
+++ b/tests/lib/App/PlatformRepositoryTest.php
@@ -11,10 +11,10 @@ use OC\App\PlatformRepository;
class PlatformRepositoryTest extends \Test\TestCase {
/**
- * @dataProvider providesVersions
* @param $expected
* @param $input
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providesVersions')]
public function testVersion($input, $expected): void {
$pr = new PlatformRepository();
$normalizedVersion = $pr->normalizeVersion($input);
diff --git a/tests/lib/AppConfigTest.php b/tests/lib/AppConfigTest.php
index 0a69eddcc94..408e4321d4f 100644
--- a/tests/lib/AppConfigTest.php
+++ b/tests/lib/AppConfigTest.php
@@ -268,11 +268,11 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerGetAppKeys
*
* @param string $appId
* @param array $expectedKeys
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetAppKeys')]
public function testGetKeys(string $appId, array $expectedKeys): void {
$config = $this->generateAppConfig();
$this->assertEqualsCanonicalizing($expectedKeys, $config->getKeys($appId));
@@ -284,13 +284,13 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerGetKeys
*
* @param string $appId
* @param string $configKey
* @param string $value
* @param bool $lazy
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetKeys')]
public function testHasKey(string $appId, string $configKey, string $value, int $type, bool $lazy): void {
$config = $this->generateAppConfig();
$this->assertEquals(true, $config->hasKey($appId, $configKey, $lazy));
@@ -321,9 +321,7 @@ class AppConfigTest extends TestCase {
$this->assertSame(true, $config->hasKey('non-sensitive-app', 'lazy-key', null));
}
- /**
- * @dataProvider providerGetKeys
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetKeys')]
public function testIsSensitive(
string $appId, string $configKey, string $configValue, int $type, bool $lazy, bool $sensitive,
): void {
@@ -365,9 +363,7 @@ class AppConfigTest extends TestCase {
$config->isSensitive('non-sensitive-app', 'lazy-key', false);
}
- /**
- * @dataProvider providerGetKeys
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetKeys')]
public function testIsLazy(string $appId, string $configKey, string $configValue, int $type, bool $lazy,
): void {
$config = $this->generateAppConfig();
@@ -408,11 +404,11 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerGetAppKeys
*
* @param string $appId
* @param array $keys
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetAppKeys')]
public function testGetAllValuesWithEmptyKey(string $appId, array $keys): void {
$config = $this->generateAppConfig();
$this->assertEqualsCanonicalizing($keys, array_keys($config->getAllValues($appId, '')));
@@ -558,23 +554,23 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerGetValueMixed
*
* @param string $key
* @param string $value
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetValueMixed')]
public function testGetValueMixed(string $key, string $value): void {
$config = $this->generateAppConfig();
$this->assertSame($value, $config->getValueMixed('typed', $key));
}
/**
- * @dataProvider providerGetValueMixed
*
* @param string $key
* @param string $value
* @param int $type
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetValueMixed')]
public function testGetValueType(string $key, string $value, int $type): void {
$config = $this->generateAppConfig();
$this->assertSame($type, $config->getValueType('typed', $key));
diff --git a/tests/lib/AppFramework/AppTest.php b/tests/lib/AppFramework/AppTest.php
index 64b4bccbac6..c43cd8e3c54 100644
--- a/tests/lib/AppFramework/AppTest.php
+++ b/tests/lib/AppFramework/AppTest.php
@@ -132,9 +132,7 @@ class AppTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider dataNoOutput
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataNoOutput')]
public function testNoOutput(string $statusCode): void {
$return = [$statusCode, [], [], $this->output, new Response()];
$this->dispatcher->expects($this->once())
diff --git a/tests/lib/AppFramework/Bootstrap/RegistrationContextTest.php b/tests/lib/AppFramework/Bootstrap/RegistrationContextTest.php
index 6469a01cce3..c0095713370 100644
--- a/tests/lib/AppFramework/Bootstrap/RegistrationContextTest.php
+++ b/tests/lib/AppFramework/Bootstrap/RegistrationContextTest.php
@@ -68,9 +68,7 @@ class RegistrationContextTest extends TestCase {
$this->context->delegateEventListenerRegistrations($dispatcher);
}
- /**
- * @dataProvider dataProvider_TrueFalse
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataProvider_TrueFalse')]
public function testRegisterService(bool $shared): void {
$app = $this->createMock(App::class);
$service = 'abc';
diff --git a/tests/lib/AppFramework/Controller/PublicShareControllerTest.php b/tests/lib/AppFramework/Controller/PublicShareControllerTest.php
index 48ec17b3edf..e676b8a0d7e 100644
--- a/tests/lib/AppFramework/Controller/PublicShareControllerTest.php
+++ b/tests/lib/AppFramework/Controller/PublicShareControllerTest.php
@@ -68,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);
diff --git a/tests/lib/AppFramework/Db/EntityTest.php b/tests/lib/AppFramework/Db/EntityTest.php
index 4fcf126e3b1..eab081e6ac6 100644
--- a/tests/lib/AppFramework/Db/EntityTest.php
+++ b/tests/lib/AppFramework/Db/EntityTest.php
@@ -225,9 +225,7 @@ class EntityTest extends \Test\TestCase {
}
- /**
- * @dataProvider dataSetterCasts
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetterCasts')]
public function testSetterCasts(string $field, mixed $in, mixed $out): void {
$entity = new TestEntity();
$entity->{'set' . $field}($in);
diff --git a/tests/lib/AppFramework/Db/QBMapperDBTest.php b/tests/lib/AppFramework/Db/QBMapperDBTest.php
index 8ad8c43bed8..614f1099644 100644
--- a/tests/lib/AppFramework/Db/QBMapperDBTest.php
+++ b/tests/lib/AppFramework/Db/QBMapperDBTest.php
@@ -64,7 +64,7 @@ class QBDBTestMapper extends QBMapper {
* @group DB
*/
class QBMapperDBTest extends TestCase {
- /** @var \Doctrine\DBAL\Connection|\OCP\IDBConnection */
+ /** @var \Doctrine\DBAL\Connection|IDBConnection */
protected $connection;
protected $schemaSetup = false;
diff --git a/tests/lib/AppFramework/Db/TransactionalTest.php b/tests/lib/AppFramework/Db/TransactionalTest.php
index bf8abcd7aa2..72a3d9ae59f 100644
--- a/tests/lib/AppFramework/Db/TransactionalTest.php
+++ b/tests/lib/AppFramework/Db/TransactionalTest.php
@@ -28,10 +28,9 @@ class TransactionalTest extends TestCase {
$test = new class($this->db) {
use TTransactional;
- private IDBConnection $db;
-
- public function __construct(IDBConnection $db) {
- $this->db = $db;
+ public function __construct(
+ private IDBConnection $db,
+ ) {
}
public function fail(): void {
@@ -55,10 +54,9 @@ class TransactionalTest extends TestCase {
$test = new class($this->db) {
use TTransactional;
- private IDBConnection $db;
-
- public function __construct(IDBConnection $db) {
- $this->db = $db;
+ public function __construct(
+ private IDBConnection $db,
+ ) {
}
public function succeed(): int {
diff --git a/tests/lib/AppFramework/Http/DispatcherTest.php b/tests/lib/AppFramework/Http/DispatcherTest.php
index 4ed6627891c..86c78e840e0 100644
--- a/tests/lib/AppFramework/Http/DispatcherTest.php
+++ b/tests/lib/AppFramework/Http/DispatcherTest.php
@@ -32,7 +32,7 @@ use Psr\Log\LoggerInterface;
class TestController extends Controller {
/**
* @param string $appName
- * @param \OCP\IRequest $request
+ * @param IRequest $request
*/
public function __construct($appName, $request) {
parent::__construct($appName, $request);
@@ -547,9 +547,7 @@ class DispatcherTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider rangeDataProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('rangeDataProvider')]
public function testEnsureParameterValueSatisfiesRange(int $min, int $max, int $input, bool $throw): void {
$this->reflector = $this->createMock(ControllerMethodReflector::class);
$this->reflector->expects($this->any())
diff --git a/tests/lib/AppFramework/Http/DownloadResponseTest.php b/tests/lib/AppFramework/Http/DownloadResponseTest.php
index cf179ba270b..b2f60edd999 100644
--- a/tests/lib/AppFramework/Http/DownloadResponseTest.php
+++ b/tests/lib/AppFramework/Http/DownloadResponseTest.php
@@ -27,9 +27,7 @@ class DownloadResponseTest extends \Test\TestCase {
$this->assertEquals('content', $headers['Content-Type']);
}
- /**
- * @dataProvider filenameEncodingProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('filenameEncodingProvider')]
public function testFilenameEncoding(string $input, string $expected): void {
$response = new ChildDownloadResponse($input, 'content');
$headers = $response->getHeaders();
diff --git a/tests/lib/AppFramework/Http/JSONResponseTest.php b/tests/lib/AppFramework/Http/JSONResponseTest.php
index 703e6d89dd1..56f67b23f0d 100644
--- a/tests/lib/AppFramework/Http/JSONResponseTest.php
+++ b/tests/lib/AppFramework/Http/JSONResponseTest.php
@@ -58,10 +58,10 @@ class JSONResponseTest extends \Test\TestCase {
}
/**
- * @dataProvider renderDataProvider
* @param array $input
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('renderDataProvider')]
public function testRender(array $input, $expected): void {
$this->json->setData($input);
$this->assertEquals($expected, $this->json->render());
diff --git a/tests/lib/AppFramework/Http/RequestTest.php b/tests/lib/AppFramework/Http/RequestTest.php
index 7107131e031..a7ff123fc25 100644
--- a/tests/lib/AppFramework/Http/RequestTest.php
+++ b/tests/lib/AppFramework/Http/RequestTest.php
@@ -260,9 +260,7 @@ class RequestTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider dataNotJsonData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataNotJsonData')]
public function testNotJsonPost(string $testData): void {
global $data;
$data = $testData;
@@ -709,9 +707,7 @@ class RequestTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider dataGetRemoteAddress
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetRemoteAddress')]
public function testGetRemoteAddress(array $headers, array $trustedProxies, array $forwardedForHeaders, string $expected): void {
$this->config
->method('getSystemValue')
@@ -760,11 +756,11 @@ class RequestTest extends \Test\TestCase {
}
/**
- * @dataProvider dataHttpProtocol
*
* @param mixed $input
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataHttpProtocol')]
public function testGetHttpProtocol($input, $expected): void {
$request = new Request(
[
@@ -950,11 +946,11 @@ class RequestTest extends \Test\TestCase {
}
/**
- * @dataProvider dataUserAgent
* @param string $testAgent
* @param array $userAgent
* @param bool $matches
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataUserAgent')]
public function testUserAgent($testAgent, $userAgent, $matches): void {
$request = new Request(
[
@@ -972,11 +968,11 @@ class RequestTest extends \Test\TestCase {
}
/**
- * @dataProvider dataUserAgent
* @param string $testAgent
* @param array $userAgent
* @param bool $matches
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataUserAgent')]
public function testUndefinedUserAgent($testAgent, $userAgent, $matches): void {
$request = new Request(
[],
@@ -1154,11 +1150,11 @@ class RequestTest extends \Test\TestCase {
}
/**
- * @dataProvider dataMatchClientVersion
* @param string $testAgent
* @param string $userAgent
* @param string $version
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataMatchClientVersion')]
public function testMatchClientVersion(string $testAgent, string $userAgent, string $version): void {
preg_match($userAgent, $testAgent, $matches);
@@ -1373,9 +1369,7 @@ class RequestTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider dataGetServerHostTrustedDomain
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetServerHostTrustedDomain')]
public function testGetServerHostTrustedDomain(string $expected, $trustedDomain): void {
$this->config
->method('getSystemValue')
@@ -1485,11 +1479,11 @@ class RequestTest extends \Test\TestCase {
}
/**
- * @dataProvider dataGenericPathInfo
* @param string $requestUri
* @param string $scriptName
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGenericPathInfo')]
public function testGetPathInfoWithoutSetEnvGeneric($requestUri, $scriptName, $expected): void {
$request = new Request(
[
@@ -1508,11 +1502,11 @@ class RequestTest extends \Test\TestCase {
}
/**
- * @dataProvider dataGenericPathInfo
* @param string $requestUri
* @param string $scriptName
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGenericPathInfo')]
public function testGetRawPathInfoWithoutSetEnvGeneric($requestUri, $scriptName, $expected): void {
$request = new Request(
[
@@ -1531,11 +1525,11 @@ class RequestTest extends \Test\TestCase {
}
/**
- * @dataProvider dataRawPathInfo
* @param string $requestUri
* @param string $scriptName
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataRawPathInfo')]
public function testGetRawPathInfoWithoutSetEnv($requestUri, $scriptName, $expected): void {
$request = new Request(
[
@@ -1554,11 +1548,11 @@ class RequestTest extends \Test\TestCase {
}
/**
- * @dataProvider dataPathInfo
* @param string $requestUri
* @param string $scriptName
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataPathInfo')]
public function testGetPathInfoWithoutSetEnv($requestUri, $scriptName, $expected): void {
$request = new Request(
[
@@ -1629,9 +1623,7 @@ class RequestTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider dataGetRequestUriWithOverwrite
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetRequestUriWithOverwrite')]
public function testGetRequestUriWithOverwrite($expectedUri, $overwriteWebRoot, $overwriteCondAddr, $remoteAddr = ''): void {
$this->config
->expects($this->exactly(2))
@@ -2184,9 +2176,7 @@ class RequestTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider dataInvalidToken
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataInvalidToken')]
public function testPassesCSRFCheckWithInvalidToken(string $invalidToken): void {
/** @var Request $request */
$request = $this->getMockBuilder(Request::class)
diff --git a/tests/lib/AppFramework/Http/ResponseTest.php b/tests/lib/AppFramework/Http/ResponseTest.php
index 7750db921c6..4c76695f6e4 100644
--- a/tests/lib/AppFramework/Http/ResponseTest.php
+++ b/tests/lib/AppFramework/Http/ResponseTest.php
@@ -16,7 +16,7 @@ use OCP\AppFramework\Utility\ITimeFactory;
class ResponseTest extends \Test\TestCase {
/**
- * @var \OCP\AppFramework\Http\Response
+ * @var Response
*/
private $childResponse;
diff --git a/tests/lib/AppFramework/Http/TemplateResponseTest.php b/tests/lib/AppFramework/Http/TemplateResponseTest.php
index ad0fe808b76..28f952e35e3 100644
--- a/tests/lib/AppFramework/Http/TemplateResponseTest.php
+++ b/tests/lib/AppFramework/Http/TemplateResponseTest.php
@@ -13,7 +13,7 @@ use OCP\AppFramework\Http\TemplateResponse;
class TemplateResponseTest extends \Test\TestCase {
/**
- * @var \OCP\AppFramework\Http\TemplateResponse
+ * @var TemplateResponse
*/
private $tpl;
diff --git a/tests/lib/AppFramework/Middleware/NotModifiedMiddlewareTest.php b/tests/lib/AppFramework/Middleware/NotModifiedMiddlewareTest.php
index 0abbd9c614c..7dcb28a2af4 100644
--- a/tests/lib/AppFramework/Middleware/NotModifiedMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/NotModifiedMiddlewareTest.php
@@ -54,9 +54,7 @@ class NotModifiedMiddlewareTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider dataModified
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataModified')]
public function testMiddleware(?string $etag, string $etagHeader, ?\DateTime $lastModified, string $lastModifiedHeader, bool $notModifiedSet): void {
$this->request->method('getHeader')
->willReturnCallback(function (string $name) use ($etagHeader, $lastModifiedHeader) {
diff --git a/tests/lib/AppFramework/Middleware/OCSMiddlewareTest.php b/tests/lib/AppFramework/Middleware/OCSMiddlewareTest.php
index 4d190ce6ba6..e5c6a417a4b 100644
--- a/tests/lib/AppFramework/Middleware/OCSMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/OCSMiddlewareTest.php
@@ -61,9 +61,7 @@ class OCSMiddlewareTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider dataAfterException
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataAfterException')]
public function testAfterExceptionOCSv1(string $controller, \Exception $exception, bool $forward, string $message = '', int $code = 0): void {
$controller = $this->createMock($controller);
$this->request
@@ -92,9 +90,7 @@ class OCSMiddlewareTest extends \Test\TestCase {
$this->assertSame(Http::STATUS_OK, $result->getStatus());
}
- /**
- * @dataProvider dataAfterException
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataAfterException')]
public function testAfterExceptionOCSv2(string $controller, \Exception $exception, bool $forward, string $message = '', int $code = 0): void {
$controller = $this->createMock($controller);
$this->request
@@ -121,9 +117,7 @@ class OCSMiddlewareTest extends \Test\TestCase {
$this->assertSame($code, $result->getStatus());
}
- /**
- * @dataProvider dataAfterException
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataAfterException')]
public function testAfterExceptionOCSv2SubFolder(string $controller, \Exception $exception, bool $forward, string $message = '', int $code = 0): void {
$controller = $this->createMock($controller);
$this->request
@@ -167,9 +161,7 @@ class OCSMiddlewareTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider dataAfterController
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataAfterController')]
public function testAfterController(string $controller, Response $response, bool $converted, int $convertedOCSStatus = 0): void {
$controller = $this->createMock($controller);
$OCSMiddleware = new OCSMiddleware($this->request);
diff --git a/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php b/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php
index b17dc9434ef..e87ee7fd565 100644
--- a/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php
@@ -67,9 +67,7 @@ class PublicShareMiddlewareTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider dataShareApi
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataShareApi')]
public function testBeforeControllerShareApiDisabled(string $shareApi, string $shareLinks): void {
$controller = $this->createMock(PublicShareController::class);
diff --git a/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php
index f9ada6a93e2..c325ae638fb 100644
--- a/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php
@@ -53,9 +53,7 @@ class CORSMiddlewareTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider dataSetCORSAPIHeader
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetCORSAPIHeader')]
public function testSetCORSAPIHeader(string $method): void {
$request = new Request(
[
@@ -98,9 +96,7 @@ class CORSMiddlewareTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider dataNoOriginHeaderNoCORSHEADER
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataNoOriginHeaderNoCORSHEADER')]
public function testNoOriginHeaderNoCORSHEADER(string $method): void {
$request = new Request(
[],
@@ -122,9 +118,7 @@ class CORSMiddlewareTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider dataCorsIgnoredIfWithCredentialsHeaderPresent
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataCorsIgnoredIfWithCredentialsHeaderPresent')]
public function testCorsIgnoredIfWithCredentialsHeaderPresent(string $method): void {
$this->expectException(SecurityException::class);
@@ -154,9 +148,7 @@ class CORSMiddlewareTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider dataNoCORSOnAnonymousPublicPage
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataNoCORSOnAnonymousPublicPage')]
public function testNoCORSOnAnonymousPublicPage(string $method): void {
$request = new Request(
[],
@@ -188,9 +180,7 @@ class CORSMiddlewareTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider dataCORSShouldNeverAllowCookieAuth
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataCORSShouldNeverAllowCookieAuth')]
public function testCORSShouldNeverAllowCookieAuth(string $method): void {
$request = new Request(
[],
@@ -220,9 +210,7 @@ class CORSMiddlewareTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider dataCORSShouldRelogin
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataCORSShouldRelogin')]
public function testCORSShouldRelogin(string $method): void {
$request = new Request(
['server' => [
@@ -251,9 +239,7 @@ class CORSMiddlewareTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider dataCORSShouldFailIfPasswordLoginIsForbidden
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataCORSShouldFailIfPasswordLoginIsForbidden')]
public function testCORSShouldFailIfPasswordLoginIsForbidden(string $method): void {
$this->expectException(SecurityException::class);
@@ -284,9 +270,7 @@ class CORSMiddlewareTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider dataCORSShouldNotAllowCookieAuth
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataCORSShouldNotAllowCookieAuth')]
public function testCORSShouldNotAllowCookieAuth(string $method): void {
$this->expectException(SecurityException::class);
diff --git a/tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php
index a109ac839c4..90e801ca471 100644
--- a/tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php
@@ -91,9 +91,7 @@ class PasswordConfirmationMiddlewareTest extends TestCase {
$this->middleware->beforeController($this->controller, __FUNCTION__);
}
- /**
- * @dataProvider dataProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataProvider')]
public function testAnnotation($backend, $lastConfirm, $currentTime, $exception): void {
$this->reflector->reflect($this->controller, __FUNCTION__);
@@ -126,9 +124,7 @@ class PasswordConfirmationMiddlewareTest extends TestCase {
$this->assertSame($exception, $thrown);
}
- /**
- * @dataProvider dataProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataProvider')]
public function testAttribute($backend, $lastConfirm, $currentTime, $exception): void {
$this->reflector->reflect($this->controller, __FUNCTION__);
diff --git a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php
index 670e1cc7ca5..0c6fc21357d 100644
--- a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php
@@ -195,9 +195,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider dataNoCSRFRequiredPublicPage
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataNoCSRFRequiredPublicPage')]
public function testSetNavigationEntry(string $method): void {
$this->navigationManager->expects($this->once())
->method('setActiveEntry')
@@ -245,9 +243,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
);
}
- /**
- * @dataProvider dataNoCSRFRequired
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataNoCSRFRequired')]
public function testAjaxNotAdminCheck(string $method): void {
$this->ajaxExceptionStatus(
$method,
@@ -256,9 +252,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
);
}
- /**
- * @dataProvider dataPublicPage
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataPublicPage')]
public function testAjaxStatusCSRFCheck(string $method): void {
$this->ajaxExceptionStatus(
$method,
@@ -267,9 +261,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
);
}
- /**
- * @dataProvider dataNoCSRFRequiredPublicPage
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataNoCSRFRequiredPublicPage')]
public function testAjaxStatusAllGood(string $method): void {
$this->ajaxExceptionStatus(
$method,
@@ -288,9 +280,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
);
}
- /**
- * @dataProvider dataNoCSRFRequiredPublicPage
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataNoCSRFRequiredPublicPage')]
public function testNoChecks(string $method): void {
$this->request->expects($this->never())
->method('passesCSRFCheck')
@@ -329,9 +319,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
}
- /**
- * @dataProvider dataPublicPage
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataPublicPage')]
public function testCsrfCheck(string $method): void {
$this->expectException(CrossSiteRequestForgeryException::class);
@@ -345,9 +333,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
$this->middleware->beforeController($this->controller, $method);
}
- /**
- * @dataProvider dataNoCSRFRequiredPublicPage
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataNoCSRFRequiredPublicPage')]
public function testNoCsrfCheck(string $method): void {
$this->request->expects($this->never())
->method('passesCSRFCheck')
@@ -357,9 +343,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
$this->middleware->beforeController($this->controller, $method);
}
- /**
- * @dataProvider dataPublicPage
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataPublicPage')]
public function testPassesCsrfCheck(string $method): void {
$this->request->expects($this->once())
->method('passesCSRFCheck')
@@ -372,9 +356,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
$this->middleware->beforeController($this->controller, $method);
}
- /**
- * @dataProvider dataPublicPage
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataPublicPage')]
public function testFailCsrfCheck(string $method): void {
$this->expectException(CrossSiteRequestForgeryException::class);
@@ -389,9 +371,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
$this->middleware->beforeController($this->controller, $method);
}
- /**
- * @dataProvider dataPublicPageStrictCookieRequired
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataPublicPageStrictCookieRequired')]
public function testStrictCookieRequiredCheck(string $method): void {
$this->expectException(\OC\AppFramework\Middleware\Security\Exceptions\StrictCookieMissingException::class);
@@ -405,9 +385,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
$this->middleware->beforeController($this->controller, $method);
}
- /**
- * @dataProvider dataNoCSRFRequiredPublicPage
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataNoCSRFRequiredPublicPage')]
public function testNoStrictCookieRequiredCheck(string $method): void {
$this->request->expects($this->never())
->method('passesStrictCookieCheck')
@@ -417,9 +395,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
$this->middleware->beforeController($this->controller, $method);
}
- /**
- * @dataProvider dataNoCSRFRequiredPublicPageStrictCookieRequired
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataNoCSRFRequiredPublicPageStrictCookieRequired')]
public function testPassesStrictCookieRequiredCheck(string $method): void {
$this->request
->expects($this->once())
@@ -445,12 +421,12 @@ class SecurityMiddlewareTest extends \Test\TestCase {
}
/**
- * @dataProvider dataCsrfOcsController
* @param string $controllerClass
* @param bool $hasOcsApiHeader
* @param bool $hasBearerAuth
* @param bool $exception
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataCsrfOcsController')]
public function testCsrfOcsController(string $controllerClass, bool $hasOcsApiHeader, bool $hasBearerAuth, bool $exception): void {
$this->request
->method('getHeader')
@@ -477,30 +453,22 @@ class SecurityMiddlewareTest extends \Test\TestCase {
}
}
- /**
- * @dataProvider dataNoAdminRequiredNoCSRFRequired
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataNoAdminRequiredNoCSRFRequired')]
public function testLoggedInCheck(string $method): void {
$this->securityCheck($method, 'isLoggedIn');
}
- /**
- * @dataProvider dataNoAdminRequiredNoCSRFRequired
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataNoAdminRequiredNoCSRFRequired')]
public function testFailLoggedInCheck(string $method): void {
$this->securityCheck($method, 'isLoggedIn', true);
}
- /**
- * @dataProvider dataNoCSRFRequired
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataNoCSRFRequired')]
public function testIsAdminCheck(string $method): void {
$this->securityCheck($method, 'isAdminUser');
}
- /**
- * @dataProvider dataNoCSRFRequiredSubAdminRequired
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataNoCSRFRequiredSubAdminRequired')]
public function testIsNotSubAdminCheck(string $method): void {
$this->reader->reflect($this->controller, $method);
$sec = $this->getMiddleware(true, false, false);
@@ -509,9 +477,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
$sec->beforeController($this->controller, $method);
}
- /**
- * @dataProvider dataNoCSRFRequiredSubAdminRequired
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataNoCSRFRequiredSubAdminRequired')]
public function testIsSubAdminCheck(string $method): void {
$this->reader->reflect($this->controller, $method);
$sec = $this->getMiddleware(true, false, true);
@@ -520,9 +486,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
$this->addToAssertionCount(1);
}
- /**
- * @dataProvider dataNoCSRFRequiredSubAdminRequired
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataNoCSRFRequiredSubAdminRequired')]
public function testIsSubAdminAndAdminCheck(string $method): void {
$this->reader->reflect($this->controller, $method);
$sec = $this->getMiddleware(true, true, true);
@@ -531,16 +495,12 @@ class SecurityMiddlewareTest extends \Test\TestCase {
$this->addToAssertionCount(1);
}
- /**
- * @dataProvider dataNoCSRFRequired
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataNoCSRFRequired')]
public function testFailIsAdminCheck(string $method): void {
$this->securityCheck($method, 'isAdminUser', true);
}
- /**
- * @dataProvider dataNoAdminRequiredNoCSRFRequiredPublicPage
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataNoAdminRequiredNoCSRFRequiredPublicPage')]
public function testRestrictedAppLoggedInPublicPage(string $method): void {
$middleware = $this->getMiddleware(true, false, false);
$this->reader->reflect($this->controller, $method);
@@ -557,9 +517,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
$this->addToAssertionCount(1);
}
- /**
- * @dataProvider dataNoAdminRequiredNoCSRFRequiredPublicPage
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataNoAdminRequiredNoCSRFRequiredPublicPage')]
public function testRestrictedAppNotLoggedInPublicPage(string $method): void {
$middleware = $this->getMiddleware(false, false, false);
$this->reader->reflect($this->controller, $method);
@@ -576,9 +534,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
$this->addToAssertionCount(1);
}
- /**
- * @dataProvider dataNoAdminRequiredNoCSRFRequired
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataNoAdminRequiredNoCSRFRequired')]
public function testRestrictedAppLoggedIn(string $method): void {
$middleware = $this->getMiddleware(true, false, false, false);
$this->reader->reflect($this->controller, $method);
@@ -675,9 +631,9 @@ class SecurityMiddlewareTest extends \Test\TestCase {
}
/**
- * @dataProvider exceptionProvider
* @param SecurityException $exception
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('exceptionProvider')]
public function testAfterExceptionReturnsTemplateResponse(SecurityException $exception): void {
$this->request = new Request(
[
@@ -711,9 +667,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
$this->assertTrue($response instanceof JSONResponse);
}
- /**
- * @dataProvider dataExAppRequired
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataExAppRequired')]
public function testExAppRequired(string $method): void {
$middleware = $this->getMiddleware(true, false, false);
$this->reader->reflect($this->controller, $method);
@@ -732,9 +686,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
$middleware->beforeController($this->controller, $method);
}
- /**
- * @dataProvider dataExAppRequired
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataExAppRequired')]
public function testExAppRequiredError(string $method): void {
$middleware = $this->getMiddleware(true, false, false, false);
$this->reader->reflect($this->controller, $method);
diff --git a/tests/lib/AppFramework/OCS/V2ResponseTest.php b/tests/lib/AppFramework/OCS/V2ResponseTest.php
index 0037763f163..7a70ad6d633 100644
--- a/tests/lib/AppFramework/OCS/V2ResponseTest.php
+++ b/tests/lib/AppFramework/OCS/V2ResponseTest.php
@@ -15,9 +15,7 @@ use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCSController;
class V2ResponseTest extends \Test\TestCase {
- /**
- * @dataProvider providesStatusCodes
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providesStatusCodes')]
public function testStatusCodeMapper(int $expected, int $sc): void {
$response = new V2Response(new DataResponse([], $sc));
$this->assertEquals($expected, $response->getStatus());
diff --git a/tests/lib/AppFramework/Services/AppConfigTest.php b/tests/lib/AppFramework/Services/AppConfigTest.php
index 718817a7636..38fa6bdcac6 100644
--- a/tests/lib/AppFramework/Services/AppConfigTest.php
+++ b/tests/lib/AppFramework/Services/AppConfigTest.php
@@ -57,11 +57,11 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerHasAppKey
*
* @param bool $lazy
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerHasAppKey')]
public function testHasAppKey(bool $lazy, bool $expected): void {
$key = 'key';
$this->appConfigCore->expects($this->once())
@@ -87,11 +87,11 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerIsSensitive
*
* @param bool $lazy
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerIsSensitive')]
public function testIsSensitive(bool $lazy, bool $expected): void {
$key = 'key';
$this->appConfigCore->expects($this->once())
@@ -103,11 +103,11 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerIsSensitive
*
* @param bool $lazy
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerIsSensitive')]
public function testIsSensitiveException(bool $lazy, bool $expected): void {
$key = 'unknown-key';
$this->appConfigCore->expects($this->once())
@@ -132,10 +132,9 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerIsLazy
- *
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerIsLazy')]
public function testIsLazy(bool $expected): void {
$key = 'key';
$this->appConfigCore->expects($this->once())
@@ -172,11 +171,11 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerGetAllAppValues
*
* @param string $key
* @param bool $filtered
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetAllAppValues')]
public function testGetAllAppValues(string $key, bool $filtered): void {
$expected = [
'key1' => 'value1',
@@ -229,12 +228,12 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerSetAppValue
*
* @param bool $lazy
* @param bool $sensitive
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerSetAppValue')]
public function testSetAppValueString(bool $lazy, bool $sensitive, bool $expected): void {
$key = 'key';
$value = 'valueString';
@@ -247,11 +246,11 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerSetAppValue
*
* @param bool $lazy
* @param bool $sensitive
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerSetAppValue')]
public function testSetAppValueStringException(bool $lazy, bool $sensitive): void {
$key = 'key';
$value = 'valueString';
@@ -265,12 +264,12 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerSetAppValue
*
* @param bool $lazy
* @param bool $sensitive
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerSetAppValue')]
public function testSetAppValueInt(bool $lazy, bool $sensitive, bool $expected): void {
$key = 'key';
$value = 42;
@@ -283,11 +282,11 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerSetAppValue
*
* @param bool $lazy
* @param bool $sensitive
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerSetAppValue')]
public function testSetAppValueIntException(bool $lazy, bool $sensitive): void {
$key = 'key';
$value = 42;
@@ -301,12 +300,12 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerSetAppValue
*
* @param bool $lazy
* @param bool $sensitive
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerSetAppValue')]
public function testSetAppValueFloat(bool $lazy, bool $sensitive, bool $expected): void {
$key = 'key';
$value = 3.14;
@@ -319,11 +318,11 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerSetAppValue
*
* @param bool $lazy
* @param bool $sensitive
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerSetAppValue')]
public function testSetAppValueFloatException(bool $lazy, bool $sensitive): void {
$key = 'key';
$value = 3.14;
@@ -351,11 +350,11 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerSetAppValueBool
*
* @param bool $lazy
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerSetAppValueBool')]
public function testSetAppValueBool(bool $lazy, bool $expected): void {
$key = 'key';
$value = true;
@@ -368,10 +367,9 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerSetAppValueBool
- *
* @param bool $lazy
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerSetAppValueBool')]
public function testSetAppValueBoolException(bool $lazy): void {
$key = 'key';
$value = true;
@@ -385,12 +383,12 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerSetAppValue
*
* @param bool $lazy
* @param bool $sensitive
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerSetAppValue')]
public function testSetAppValueArray(bool $lazy, bool $sensitive, bool $expected): void {
$key = 'key';
$value = ['item' => true];
@@ -403,11 +401,11 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerSetAppValue
*
* @param bool $lazy
* @param bool $sensitive
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerSetAppValue')]
public function testSetAppValueArrayException(bool $lazy, bool $sensitive): void {
$key = 'key';
$value = ['item' => true];
@@ -467,11 +465,11 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerGetAppValue
*
* @param bool $lazy
* @param bool $exist
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetAppValue')]
public function testGetAppValueString(bool $lazy, bool $exist): void {
$key = 'key';
$value = 'valueString';
@@ -487,10 +485,9 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerGetAppValue
- *
* @param bool $lazy
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetAppValue')]
public function testGetAppValueStringException(bool $lazy): void {
$key = 'key';
$default = 'default';
@@ -505,11 +502,11 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerGetAppValue
*
* @param bool $lazy
* @param bool $exist
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetAppValue')]
public function testGetAppValueInt(bool $lazy, bool $exist): void {
$key = 'key';
$value = 42;
@@ -525,10 +522,9 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerGetAppValue
- *
* @param bool $lazy
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetAppValue')]
public function testGetAppValueIntException(bool $lazy): void {
$key = 'key';
$default = 17;
@@ -543,11 +539,11 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerGetAppValue
*
* @param bool $lazy
* @param bool $exist
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetAppValue')]
public function testGetAppValueFloat(bool $lazy, bool $exist): void {
$key = 'key';
$value = 3.14;
@@ -563,10 +559,9 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerGetAppValue
- *
* @param bool $lazy
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetAppValue')]
public function testGetAppValueFloatException(bool $lazy): void {
$key = 'key';
$default = 17.04;
@@ -581,11 +576,11 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerGetAppValue
*
* @param bool $lazy
* @param bool $exist
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetAppValue')]
public function testGetAppValueBool(bool $lazy, bool $exist): void {
$key = 'key';
$value = true;
@@ -601,10 +596,9 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerGetAppValue
- *
* @param bool $lazy
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetAppValue')]
public function testGetAppValueBoolException(bool $lazy): void {
$key = 'key';
$default = false;
@@ -619,11 +613,11 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerGetAppValue
*
* @param bool $lazy
* @param bool $exist
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetAppValue')]
public function testGetAppValueArray(bool $lazy, bool $exist): void {
$key = 'key';
$value = ['item' => true];
@@ -639,10 +633,9 @@ class AppConfigTest extends TestCase {
}
/**
- * @dataProvider providerGetAppValue
- *
* @param bool $lazy
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetAppValue')]
public function testGetAppValueArrayException(bool $lazy): void {
$key = 'key';
$default = [];
diff --git a/tests/lib/AppFramework/Utility/SimpleContainerTest.php b/tests/lib/AppFramework/Utility/SimpleContainerTest.php
index 93db01d3bc8..33800c7376f 100644
--- a/tests/lib/AppFramework/Utility/SimpleContainerTest.php
+++ b/tests/lib/AppFramework/Utility/SimpleContainerTest.php
@@ -201,9 +201,7 @@ class SimpleContainerTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider sanitizeNameProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('sanitizeNameProvider')]
public function testSanitizeName($register, $query): void {
$this->container->registerService($register, function () {
return 'abc';
diff --git a/tests/lib/AppTest.php b/tests/lib/AppTest.php
index 77fe20ef57a..e174a59bfaf 100644
--- a/tests/lib/AppTest.php
+++ b/tests/lib/AppTest.php
@@ -314,9 +314,7 @@ class AppTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider appVersionsProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('appVersionsProvider')]
public function testIsAppCompatible($ocVersion, $appInfo, $expectedResult): void {
$this->assertEquals($expectedResult, \OC_App::isAppCompatible($ocVersion, $appInfo));
}
@@ -468,9 +466,8 @@ class AppTest extends \Test\TestCase {
/**
* Test enabled apps
- *
- * @dataProvider appConfigValuesProvider
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('appConfigValuesProvider')]
public function testEnabledApps($user, $expectedApps, $forceAll): void {
$userManager = Server::get(IUserManager::class);
$groupManager = Server::get(IGroupManager::class);
@@ -575,7 +572,7 @@ class AppTest extends \Test\TestCase {
Server::get(IEventDispatcher::class),
Server::get(LoggerInterface::class),
Server::get(ServerVersion::class),
- \OCP\Server::get(ConfigManager::class),
+ Server::get(ConfigManager::class),
));
}
@@ -624,10 +621,10 @@ class AppTest extends \Test\TestCase {
/**
* Test app info parser
*
- * @dataProvider appDataProvider
* @param array $data
* @param array $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('appDataProvider')]
public function testParseAppInfo(array $data, array $expected): void {
$this->assertSame($expected, \OC_App::parseAppInfo($data));
}
diff --git a/tests/lib/Authentication/Token/ManagerTest.php b/tests/lib/Authentication/Token/ManagerTest.php
index 300517fab4a..58bbe236248 100644
--- a/tests/lib/Authentication/Token/ManagerTest.php
+++ b/tests/lib/Authentication/Token/ManagerTest.php
@@ -157,9 +157,7 @@ class ManagerTest extends TestCase {
}
}
- /**
- * @dataProvider tokenData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('tokenData')]
public function testUpdateToken(IToken|string $token): void {
if (is_string($token)) {
$token = $this->createMock($token);
@@ -172,9 +170,7 @@ class ManagerTest extends TestCase {
$this->manager->updateToken($token);
}
- /**
- * @dataProvider tokenData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('tokenData')]
public function testUpdateTokenActivity(IToken|string $token): void {
if (is_string($token)) {
$token = $this->createMock($token);
@@ -187,9 +183,7 @@ class ManagerTest extends TestCase {
$this->manager->updateTokenActivity($token);
}
- /**
- * @dataProvider tokenData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('tokenData')]
public function testGetPassword(IToken|string $token): void {
if (is_string($token)) {
$token = $this->createMock($token);
@@ -204,9 +198,7 @@ class ManagerTest extends TestCase {
$this->assertSame('password', $result);
}
- /**
- * @dataProvider tokenData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('tokenData')]
public function testSetPassword(IToken|string $token): void {
if (is_string($token)) {
$token = $this->createMock($token);
diff --git a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php
index c68d1de60c5..a2bed8a3652 100644
--- a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php
+++ b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php
@@ -218,9 +218,8 @@ class ManagerTest extends TestCase {
* enabled providers.
*
* If any of these providers is active, 2FA is enabled
- *
- * @dataProvider providerStatesFixData
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerStatesFixData')]
public function testIsTwoFactorAuthenticatedFixesProviderStates(bool $providerEnabled, bool $expected): void {
$this->providerRegistry->expects($this->once())
->method('getProviderStates')
diff --git a/tests/lib/Avatar/AvatarManagerTest.php b/tests/lib/Avatar/AvatarManagerTest.php
index 3ce9fc41800..23d3b9d1c2a 100644
--- a/tests/lib/Avatar/AvatarManagerTest.php
+++ b/tests/lib/Avatar/AvatarManagerTest.php
@@ -204,9 +204,7 @@ class AvatarManagerTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider dataGetAvatarScopes
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetAvatarScopes')]
public function testGetAvatarScopes($avatarScope, $isPublicCall, $isKnownUser, $expectedPlaceholder): void {
if ($isPublicCall) {
$requestingUser = null;
diff --git a/tests/lib/Avatar/UserAvatarTest.php b/tests/lib/Avatar/UserAvatarTest.php
index 081284158eb..03a868c7854 100644
--- a/tests/lib/Avatar/UserAvatarTest.php
+++ b/tests/lib/Avatar/UserAvatarTest.php
@@ -27,10 +27,10 @@ class UserAvatarTest extends \Test\TestCase {
/** @var \OC\Avatar\UserAvatar */
private $avatar;
- /** @var \OC\User\User | \PHPUnit\Framework\MockObject\MockObject $user */
+ /** @var User|\PHPUnit\Framework\MockObject\MockObject $user */
private $user;
- /** @var \OCP\IConfig|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
private $config;
protected function setUp(): void {
@@ -247,9 +247,7 @@ class UserAvatarTest extends \Test\TestCase {
}
- /**
- * @dataProvider avatarTextData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('avatarTextData')]
public function testGetAvatarText($displayName, $expectedAvatarText): void {
$user = $this->getUserWithDisplayName($displayName);
$avatar = $this->getUserAvatar($user);
@@ -287,7 +285,7 @@ class UserAvatarTest extends \Test\TestCase {
}
private function getUserAvatar($user) {
- /** @var \OCP\IL10N | \PHPUnit\Framework\MockObject\MockObject $l */
+ /** @var IL10N|\PHPUnit\Framework\MockObject\MockObject $l */
$l = $this->createMock(IL10N::class);
$l->method('t')->willReturnArgument(0);
diff --git a/tests/lib/BackgroundJob/DummyJobList.php b/tests/lib/BackgroundJob/DummyJobList.php
index de4a2832d1b..717db52715f 100644
--- a/tests/lib/BackgroundJob/DummyJobList.php
+++ b/tests/lib/BackgroundJob/DummyJobList.php
@@ -10,6 +10,7 @@ namespace Test\BackgroundJob;
use OC\BackgroundJob\JobList;
use OCP\BackgroundJob\IJob;
+use OCP\BackgroundJob\Job;
use OCP\Server;
/**
@@ -132,7 +133,7 @@ class DummyJobList extends JobList {
/**
* set the job that was last ran
*
- * @param \OCP\BackgroundJob\Job $job
+ * @param Job $job
*/
public function setLastJob(IJob $job): void {
$i = array_search($job, $this->jobs);
diff --git a/tests/lib/BackgroundJob/JobListTest.php b/tests/lib/BackgroundJob/JobListTest.php
index 2c3461f22cd..d816bf707e8 100644
--- a/tests/lib/BackgroundJob/JobListTest.php
+++ b/tests/lib/BackgroundJob/JobListTest.php
@@ -30,13 +30,13 @@ class JobListTest extends TestCase {
/** @var \OC\BackgroundJob\JobList */
protected $instance;
- /** @var \OCP\IDBConnection */
+ /** @var IDBConnection */
protected $connection;
- /** @var \OCP\IConfig|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
protected $config;
- /** @var \OCP\AppFramework\Utility\ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */
protected $timeFactory;
private bool $ran = false;
@@ -90,9 +90,9 @@ class JobListTest extends TestCase {
}
/**
- * @dataProvider argumentProvider
* @param $argument
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('argumentProvider')]
public function testAddRemove($argument): void {
$existingJobs = $this->getAllSorted();
$job = new TestJob();
@@ -112,9 +112,9 @@ class JobListTest extends TestCase {
}
/**
- * @dataProvider argumentProvider
* @param $argument
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('argumentProvider')]
public function testRemoveDifferentArgument($argument): void {
$existingJobs = $this->getAllSorted();
$job = new TestJob();
@@ -133,9 +133,9 @@ class JobListTest extends TestCase {
}
/**
- * @dataProvider argumentProvider
* @param $argument
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('argumentProvider')]
public function testHas($argument): void {
$job = new TestJob();
$this->assertFalse($this->instance->has($job, $argument));
@@ -149,9 +149,9 @@ class JobListTest extends TestCase {
}
/**
- * @dataProvider argumentProvider
* @param $argument
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('argumentProvider')]
public function testHasDifferentArgument($argument): void {
$job = new TestJob();
$this->instance->add($job, $argument);
@@ -241,9 +241,9 @@ class JobListTest extends TestCase {
}
/**
- * @dataProvider argumentProvider
* @param $argument
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('argumentProvider')]
public function testGetById($argument): void {
$job = new TestJob();
$this->instance->add($job, $argument);
diff --git a/tests/lib/Cache/FileCacheTest.php b/tests/lib/Cache/FileCacheTest.php
index f8ee0cee089..4daa8d3b7ef 100644
--- a/tests/lib/Cache/FileCacheTest.php
+++ b/tests/lib/Cache/FileCacheTest.php
@@ -11,6 +11,7 @@ namespace Test\Cache;
use OC\Cache\File;
use OC\Files\Filesystem;
use OC\Files\Storage\Local;
+use OC\Files\Storage\Storage;
use OC\Files\Storage\Temporary;
use OC\Files\View;
use OCP\Files\LockNotAcquiredException;
@@ -39,11 +40,11 @@ class FileCacheTest extends TestCache {
* */
private $datadir;
/**
- * @var \OC\Files\Storage\Storage
+ * @var Storage
* */
private $storage;
/**
- * @var \OC\Files\View
+ * @var View
* */
private $rootView;
@@ -141,9 +142,7 @@ class FileCacheTest extends TestCache {
];
}
- /**
- * @dataProvider lockExceptionProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('lockExceptionProvider')]
public function testGarbageCollectIgnoreLockedKeys($testException): void {
$mockStorage = $this->setupMockStorage();
diff --git a/tests/lib/Cache/TestCache.php b/tests/lib/Cache/TestCache.php
index 231feaeefe1..ec150152816 100644
--- a/tests/lib/Cache/TestCache.php
+++ b/tests/lib/Cache/TestCache.php
@@ -8,9 +8,11 @@
namespace Test\Cache;
+use OCP\ICache;
+
abstract class TestCache extends \Test\TestCase {
/**
- * @var \OCP\ICache cache;
+ * @var ICache cache;
*/
protected $instance;
diff --git a/tests/lib/Calendar/ManagerTest.php b/tests/lib/Calendar/ManagerTest.php
index a136dac3224..fec2cfa0efe 100644
--- a/tests/lib/Calendar/ManagerTest.php
+++ b/tests/lib/Calendar/ManagerTest.php
@@ -144,9 +144,7 @@ class ManagerTest extends TestCase {
}
- /**
- * @dataProvider searchProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('searchProvider')]
public function testSearch($search1, $search2, $expected): void {
/** @var ICalendar | MockObject $calendar1 */
$calendar1 = $this->createMock(ICalendar::class);
@@ -171,9 +169,7 @@ class ManagerTest extends TestCase {
$this->assertEquals($expected, $result);
}
- /**
- * @dataProvider searchProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('searchProvider')]
public function testSearchOptions($search1, $search2, $expected): void {
/** @var ICalendar | MockObject $calendar1 */
$calendar1 = $this->createMock(ICalendar::class);
diff --git a/tests/lib/Collaboration/Collaborators/GroupPluginTest.php b/tests/lib/Collaboration/Collaborators/GroupPluginTest.php
index b4a7f4ecc10..a4ecd598562 100644
--- a/tests/lib/Collaboration/Collaborators/GroupPluginTest.php
+++ b/tests/lib/Collaboration/Collaborators/GroupPluginTest.php
@@ -418,7 +418,6 @@ class GroupPluginTest extends TestCase {
}
/**
- * @dataProvider dataGetGroups
*
* @param string $searchTerm
* @param bool $shareWithGroupOnly
@@ -431,6 +430,7 @@ class GroupPluginTest extends TestCase {
* @param bool $reachedEnd
* @param bool|IGroup $singleGroup
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetGroups')]
public function testSearch(
string $searchTerm,
bool $shareWithGroupOnly,
diff --git a/tests/lib/Collaboration/Collaborators/LookupPluginTest.php b/tests/lib/Collaboration/Collaborators/LookupPluginTest.php
index 461264e07cc..ac9b196ea1e 100644
--- a/tests/lib/Collaboration/Collaborators/LookupPluginTest.php
+++ b/tests/lib/Collaboration/Collaborators/LookupPluginTest.php
@@ -118,9 +118,9 @@ class LookupPluginTest extends TestCase {
}
/**
- * @dataProvider searchDataProvider
* @param array $searchParams
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('searchDataProvider')]
public function testSearch(array $searchParams): void {
$type = new SearchResultType('lookup');
@@ -176,11 +176,11 @@ class LookupPluginTest extends TestCase {
/**
- * @dataProvider dataSearchEnableDisableLookupServer
* @param array $searchParams
* @param bool $GSEnabled
* @param bool $LookupEnabled
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSearchEnableDisableLookupServer')]
public function testSearchEnableDisableLookupServer(array $searchParams, $GSEnabled, $LookupEnabled): void {
$type = new SearchResultType('lookup');
diff --git a/tests/lib/Collaboration/Collaborators/MailPluginTest.php b/tests/lib/Collaboration/Collaborators/MailPluginTest.php
index 5ef98ba46a6..502b7844a2a 100644
--- a/tests/lib/Collaboration/Collaborators/MailPluginTest.php
+++ b/tests/lib/Collaboration/Collaborators/MailPluginTest.php
@@ -87,7 +87,6 @@ class MailPluginTest extends TestCase {
}
/**
- * @dataProvider dataGetEmail
*
* @param string $searchTerm
* @param array $contacts
@@ -95,6 +94,7 @@ class MailPluginTest extends TestCase {
* @param array $expected
* @param bool $reachedEnd
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetEmail')]
public function testSearch($searchTerm, $contacts, $shareeEnumeration, $expected, $exactIdMatch, $reachedEnd, $validEmail): void {
$this->config->expects($this->any())
->method('getAppValue')
@@ -569,7 +569,6 @@ class MailPluginTest extends TestCase {
}
/**
- * @dataProvider dataGetEmailGroupsOnly
*
* @param string $searchTerm
* @param array $contacts
@@ -578,6 +577,7 @@ class MailPluginTest extends TestCase {
* @param bool $reachedEnd
* @param array groups
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetEmailGroupsOnly')]
public function testSearchGroupsOnly($searchTerm, $contacts, $expected, $exactIdMatch, $reachedEnd, $userToGroupMapping, $validEmail): void {
$this->config->expects($this->any())
->method('getAppValue')
@@ -594,7 +594,7 @@ class MailPluginTest extends TestCase {
$this->instantiatePlugin();
- /** @var \OCP\IUser | \PHPUnit\Framework\MockObject\MockObject */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject */
$currentUser = $this->createMock('\OCP\IUser');
$currentUser->expects($this->any())
diff --git a/tests/lib/Collaboration/Collaborators/RemotePluginTest.php b/tests/lib/Collaboration/Collaborators/RemotePluginTest.php
index 1ff85497cab..ea81b1cbcdc 100644
--- a/tests/lib/Collaboration/Collaborators/RemotePluginTest.php
+++ b/tests/lib/Collaboration/Collaborators/RemotePluginTest.php
@@ -71,7 +71,6 @@ class RemotePluginTest extends TestCase {
}
/**
- * @dataProvider dataGetRemote
*
* @param string $searchTerm
* @param array $contacts
@@ -80,6 +79,7 @@ class RemotePluginTest extends TestCase {
* @param bool $exactIdMatch
* @param bool $reachedEnd
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetRemote')]
public function testSearch($searchTerm, array $contacts, $shareeEnumeration, array $expected, $exactIdMatch, $reachedEnd): void {
$this->config->expects($this->any())
->method('getAppValue')
@@ -112,12 +112,12 @@ class RemotePluginTest extends TestCase {
}
/**
- * @dataProvider dataTestSplitUserRemote
*
* @param string $remote
* @param string $expectedUser
* @param string $expectedUrl
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestSplitUserRemote')]
public function testSplitUserRemote($remote, $expectedUser, $expectedUrl): void {
$this->instantiatePlugin();
@@ -131,10 +131,9 @@ class RemotePluginTest extends TestCase {
}
/**
- * @dataProvider dataTestSplitUserRemoteError
- *
* @param string $id
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestSplitUserRemoteError')]
public function testSplitUserRemoteError($id): void {
$this->expectException(\Exception::class);
diff --git a/tests/lib/Collaboration/Collaborators/SearchResultTest.php b/tests/lib/Collaboration/Collaborators/SearchResultTest.php
index 3b11a6724ef..687901c47a6 100644
--- a/tests/lib/Collaboration/Collaborators/SearchResultTest.php
+++ b/tests/lib/Collaboration/Collaborators/SearchResultTest.php
@@ -38,10 +38,10 @@ class SearchResultTest extends TestCase {
}
/**
- * @dataProvider dataAddResultSet
* @param array $toAdd
* @param array $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataAddResultSet')]
public function testAddResultSet(array $toAdd, array $expected): void {
$result = new SearchResult();
@@ -67,12 +67,12 @@ class SearchResultTest extends TestCase {
}
/**
- * @dataProvider dataHasResult
* @param array $toAdd
* @param string $type
* @param string $id
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataHasResult')]
public function testHasResult(array $toAdd, $type, $id, $expected): void {
$result = new SearchResult();
diff --git a/tests/lib/Collaboration/Collaborators/SearchTest.php b/tests/lib/Collaboration/Collaborators/SearchTest.php
index fe4492e784d..ade995ea526 100644
--- a/tests/lib/Collaboration/Collaborators/SearchTest.php
+++ b/tests/lib/Collaboration/Collaborators/SearchTest.php
@@ -30,9 +30,7 @@ class SearchTest extends TestCase {
$this->search = new Search($this->container);
}
- /**
- * @dataProvider dataSearchSharees
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSearchSharees')]
public function testSearch(
string $searchTerm,
array $shareTypes,
diff --git a/tests/lib/Collaboration/Collaborators/UserPluginTest.php b/tests/lib/Collaboration/Collaborators/UserPluginTest.php
index e8ee358c394..cb4949fb86d 100644
--- a/tests/lib/Collaboration/Collaborators/UserPluginTest.php
+++ b/tests/lib/Collaboration/Collaborators/UserPluginTest.php
@@ -418,7 +418,6 @@ class UserPluginTest extends TestCase {
}
/**
- * @dataProvider dataGetUsers
*
* @param string $searchTerm
* @param bool $shareWithGroupOnly
@@ -431,6 +430,7 @@ class UserPluginTest extends TestCase {
* @param bool|IUser $singleUser
* @param array $users
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetUsers')]
public function testSearch(
$searchTerm,
$shareWithGroupOnly,
@@ -535,11 +535,11 @@ class UserPluginTest extends TestCase {
}
/**
- * @dataProvider takeOutCurrentUserProvider
* @param array $users
* @param array $expectedUIDs
* @param $currentUserId
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('takeOutCurrentUserProvider')]
public function testTakeOutCurrentUser(array $users, array $expectedUIDs, $currentUserId): void {
$this->instantiatePlugin();
@@ -717,9 +717,7 @@ class UserPluginTest extends TestCase {
];
}
- /**
- * @dataProvider dataSearchEnumeration
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSearchEnumeration')]
public function testSearchEnumerationLimit($search, $userGroups, $matchingUsers, $result, $mockedSettings): void {
$this->mockConfig($mockedSettings);
diff --git a/tests/lib/Command/AsyncBusTestCase.php b/tests/lib/Command/AsyncBusTestCase.php
index 6aca4d8d6e6..bb47de30b11 100644
--- a/tests/lib/Command/AsyncBusTestCase.php
+++ b/tests/lib/Command/AsyncBusTestCase.php
@@ -64,7 +64,7 @@ abstract class AsyncBusTestCase extends TestCase {
public static $lastCommand;
/**
- * @var \OCP\Command\IBus
+ * @var IBus
*/
private $bus;
diff --git a/tests/lib/Command/BackgroundModeTest.php b/tests/lib/Command/BackgroundModeTest.php
index 2f874deb78a..ab036ef87ee 100644
--- a/tests/lib/Command/BackgroundModeTest.php
+++ b/tests/lib/Command/BackgroundModeTest.php
@@ -35,9 +35,7 @@ class BackgroundModeTest extends TestCase {
$this->command->setDefinition($inputDefinition);
}
- /**
- * @dataProvider dataModeCommand
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataModeCommand')]
public function testModeCommand(string $mode): void {
$this->appConfig->expects($this->once())
->method('setValueString')
diff --git a/tests/lib/Command/CronBusTest.php b/tests/lib/Command/CronBusTest.php
index 983e62992d0..c86cdcb1da0 100644
--- a/tests/lib/Command/CronBusTest.php
+++ b/tests/lib/Command/CronBusTest.php
@@ -8,6 +8,7 @@
namespace Test\Command;
use OC\Command\CronBus;
+use OCP\BackgroundJob\IJobList;
use Test\BackgroundJob\DummyJobList;
/**
@@ -15,7 +16,7 @@ use Test\BackgroundJob\DummyJobList;
*/
class CronBusTest extends AsyncBusTestCase {
/**
- * @var \OCP\BackgroundJob\IJobList
+ * @var IJobList
*/
private $jobList;
diff --git a/tests/lib/Comments/CommentTest.php b/tests/lib/Comments/CommentTest.php
index ca5d12f932c..4a320666c83 100644
--- a/tests/lib/Comments/CommentTest.php
+++ b/tests/lib/Comments/CommentTest.php
@@ -15,7 +15,7 @@ use Test\TestCase;
class CommentTest extends TestCase {
/**
- * @throws \OCP\Comments\IllegalIDChangeException
+ * @throws IllegalIDChangeException
*/
public function testSettersValidInput(): void {
$comment = new Comment();
@@ -74,7 +74,7 @@ class CommentTest extends TestCase {
}
/**
- * @throws \OCP\Comments\IllegalIDChangeException
+ * @throws IllegalIDChangeException
*/
public function testResetId(): void {
$comment = new Comment();
@@ -96,9 +96,7 @@ class CommentTest extends TestCase {
];
}
- /**
- * @dataProvider simpleSetterProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('simpleSetterProvider')]
public function testSimpleSetterInvalidInput($field, $input): void {
$this->expectException(\InvalidArgumentException::class);
@@ -121,9 +119,7 @@ class CommentTest extends TestCase {
];
}
- /**
- * @dataProvider roleSetterProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('roleSetterProvider')]
public function testSetRoleInvalidInput($role, $type, $id): void {
$this->expectException(\InvalidArgumentException::class);
@@ -209,12 +205,12 @@ class CommentTest extends TestCase {
}
/**
- * @dataProvider mentionsProvider
*
* @param string $message
* @param array $expectedMentions
* @param ?string $author
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('mentionsProvider')]
public function testMentions(string $message, array $expectedMentions, ?string $author = null): void {
$comment = new Comment();
$comment->setMessage($message);
diff --git a/tests/lib/Comments/ManagerTest.php b/tests/lib/Comments/ManagerTest.php
index 5d03bb06521..bd991a5692a 100644
--- a/tests/lib/Comments/ManagerTest.php
+++ b/tests/lib/Comments/ManagerTest.php
@@ -376,9 +376,7 @@ class ManagerTest extends TestCase {
], $amount);
}
- /**
- * @dataProvider dataGetForObjectSince
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetForObjectSince')]
public function testGetForObjectSince(?int $lastKnown, string $order, int $limit, int $resultFrom, int $resultTo): void {
$ids = [];
$ids[] = $this->addDatabaseEntry(0, 0);
@@ -424,9 +422,7 @@ class ManagerTest extends TestCase {
];
}
- /**
- * @dataProvider invalidCreateArgsProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('invalidCreateArgsProvider')]
public function testCreateCommentInvalidArguments(string|int $aType, string|int $aId, string|int $oType, string|int $oId): void {
$this->expectException(\InvalidArgumentException::class);
@@ -471,9 +467,7 @@ class ManagerTest extends TestCase {
$manager->get($id);
}
- /**
- * @dataProvider providerTestSave
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerTestSave')]
public function testSave(string $message, string $actorId, string $verb, ?string $parentId, ?string $id = ''): IComment {
$manager = $this->getManager();
$comment = new Comment();
@@ -613,9 +607,7 @@ class ManagerTest extends TestCase {
];
}
- /**
- * @dataProvider invalidActorArgsProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('invalidActorArgsProvider')]
public function testDeleteReferencesOfActorInvalidInput(string|int $type, string|int $id): void {
$this->expectException(\InvalidArgumentException::class);
@@ -680,9 +672,7 @@ class ManagerTest extends TestCase {
];
}
- /**
- * @dataProvider invalidObjectArgsProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('invalidObjectArgsProvider')]
public function testDeleteCommentsAtObjectInvalidInput(string|int $type, string|int $id): void {
$this->expectException(\InvalidArgumentException::class);
@@ -1006,9 +996,7 @@ class ManagerTest extends TestCase {
}
}
- /**
- * @dataProvider providerTestReactionAddAndDelete
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerTestReactionAddAndDelete')]
public function testReactionAddAndDelete(array $comments, array $reactionsExpected): void {
$this->skipIfNotSupport4ByteUTF();
$manager = $this->getManager();
@@ -1093,9 +1081,7 @@ class ManagerTest extends TestCase {
return $comments;
}
- /**
- * @dataProvider providerTestRetrieveAllReactions
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerTestRetrieveAllReactions')]
public function testRetrieveAllReactions(array $comments, array $expected): void {
$this->skipIfNotSupport4ByteUTF();
$manager = $this->getManager();
@@ -2357,9 +2343,7 @@ class ManagerTest extends TestCase {
];
}
- /**
- * @dataProvider providerTestRetrieveAllReactionsWithSpecificReaction
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerTestRetrieveAllReactionsWithSpecificReaction')]
public function testRetrieveAllReactionsWithSpecificReaction(array $comments, string $reaction, array $expected): void {
$this->skipIfNotSupport4ByteUTF();
$manager = $this->getManager();
@@ -2412,9 +2396,7 @@ class ManagerTest extends TestCase {
];
}
- /**
- * @dataProvider providerTestGetReactionComment
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerTestGetReactionComment')]
public function testGetReactionComment(array $comments, array $expected, bool $notFound): void {
$this->skipIfNotSupport4ByteUTF();
$manager = $this->getManager();
@@ -2481,9 +2463,7 @@ class ManagerTest extends TestCase {
];
}
- /**
- * @dataProvider providerTestReactionMessageSize
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerTestReactionMessageSize')]
public function testReactionMessageSize(string $reactionString, bool $valid): void {
$this->skipIfNotSupport4ByteUTF();
if (!$valid) {
@@ -2512,9 +2492,7 @@ class ManagerTest extends TestCase {
];
}
- /**
- * @dataProvider providerTestReactionsSummarizeOrdered
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerTestReactionsSummarizeOrdered')]
public function testReactionsSummarizeOrdered(array $comments, array $expected, bool $isFullMatch): void {
$this->skipIfNotSupport4ByteUTF();
$manager = $this->getManager();
diff --git a/tests/lib/Config/UserConfigTest.php b/tests/lib/Config/UserConfigTest.php
index 09d19964249..2c8222576c4 100644
--- a/tests/lib/Config/UserConfigTest.php
+++ b/tests/lib/Config/UserConfigTest.php
@@ -348,9 +348,7 @@ class UserConfigTest extends TestCase {
];
}
- /**
- * @dataProvider providerHasKey
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerHasKey')]
public function testHasKey(string $userId, string $appId, string $key, ?bool $lazy, bool $result): void {
$userConfig = $this->generateUserConfig();
$this->assertEquals($result, $userConfig->hasKey($userId, $appId, $key, $lazy));
@@ -375,9 +373,7 @@ class UserConfigTest extends TestCase {
];
}
- /**
- * @dataProvider providerIsSensitive
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerIsSensitive')]
public function testIsSensitive(
string $userId,
string $appId,
@@ -406,9 +402,7 @@ class UserConfigTest extends TestCase {
];
}
- /**
- * @dataProvider providerIsLazy
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerIsLazy')]
public function testIsLazy(
string $userId,
string $appId,
@@ -541,9 +535,7 @@ class UserConfigTest extends TestCase {
];
}
- /**
- * @dataProvider providerGetValues
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetValues')]
public function testGetValues(
string $userId,
string $appId,
@@ -642,9 +634,7 @@ class UserConfigTest extends TestCase {
];
}
- /**
- * @dataProvider providerGetAllValues
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetAllValues')]
public function testGetAllValues(
string $userId,
bool $filtered,
@@ -686,9 +676,7 @@ class UserConfigTest extends TestCase {
];
}
- /**
- * @dataProvider providerSearchValuesByApps
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerSearchValuesByApps')]
public function testSearchValuesByApps(
string $userId,
string $key,
@@ -736,9 +724,7 @@ class UserConfigTest extends TestCase {
];
}
- /**
- * @dataProvider providerSearchValuesByUsers
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerSearchValuesByUsers')]
public function testSearchValuesByUsers(
string $app,
string $key,
@@ -760,9 +746,7 @@ class UserConfigTest extends TestCase {
];
}
- /**
- * @dataProvider providerSearchValuesByValueString
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerSearchValuesByValueString')]
public function testSearchUsersByValueString(
string $app,
string $key,
@@ -782,9 +766,7 @@ class UserConfigTest extends TestCase {
];
}
- /**
- * @dataProvider providerSearchValuesByValueInt
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerSearchValuesByValueInt')]
public function testSearchUsersByValueInt(
string $app,
string $key,
@@ -802,9 +784,7 @@ class UserConfigTest extends TestCase {
];
}
- /**
- * @dataProvider providerSearchValuesByValues
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerSearchValuesByValues')]
public function testSearchUsersByValues(
string $app,
string $key,
@@ -822,9 +802,7 @@ class UserConfigTest extends TestCase {
];
}
- /**
- * @dataProvider providerSearchValuesByValueBool
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerSearchValuesByValueBool')]
public function testSearchUsersByValueBool(
string $app,
string $key,
@@ -903,9 +881,7 @@ class UserConfigTest extends TestCase {
];
}
- /**
- * @dataProvider providerGetValueMixed
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetValueMixed')]
public function testGetValueMixed(
?array $preload,
string $userId,
@@ -919,9 +895,7 @@ class UserConfigTest extends TestCase {
$this->assertEquals($result, $userConfig->getValueMixed($userId, $app, $key, $default, $lazy));
}
- /**
- * @dataProvider providerGetValueMixed
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetValueMixed')]
public function testGetValueString(
?array $preload,
string $userId,
@@ -961,9 +935,7 @@ class UserConfigTest extends TestCase {
];
}
- /**
- * @dataProvider providerGetValueInt
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetValueInt')]
public function testGetValueInt(
?array $preload,
string $userId,
@@ -1002,9 +974,7 @@ class UserConfigTest extends TestCase {
];
}
- /**
- * @dataProvider providerGetValueFloat
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetValueFloat')]
public function testGetValueFloat(
?array $preload,
string $userId,
@@ -1063,9 +1033,7 @@ class UserConfigTest extends TestCase {
];
}
- /**
- * @dataProvider providerGetValueBool
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetValueBool')]
public function testGetValueBool(
?array $preload,
string $userId,
@@ -1100,9 +1068,7 @@ class UserConfigTest extends TestCase {
];
}
- /**
- * @dataProvider providerGetValueArray
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetValueArray')]
public function testGetValueArray(
?array $preload,
string $userId,
@@ -1156,9 +1122,7 @@ class UserConfigTest extends TestCase {
];
}
- /**
- * @dataProvider providerGetValueType
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetValueType')]
public function testGetValueType(
?array $preload,
string $userId,
@@ -1215,9 +1179,7 @@ class UserConfigTest extends TestCase {
];
}
- /**
- * @dataProvider providerSetValueMixed
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerSetValueMixed')]
public function testSetValueMixed(
?array $preload,
string $userId,
@@ -1298,9 +1260,7 @@ class UserConfigTest extends TestCase {
];
}
- /**
- * @dataProvider providerSetValueString
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerSetValueString')]
public function testSetValueString(
?array $preload,
string $userId,
@@ -1361,9 +1321,7 @@ class UserConfigTest extends TestCase {
];
}
- /**
- * @dataProvider providerSetValueInt
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerSetValueInt')]
public function testSetValueInt(
?array $preload,
string $userId,
@@ -1424,9 +1382,7 @@ class UserConfigTest extends TestCase {
];
}
- /**
- * @dataProvider providerSetValueFloat
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerSetValueFloat')]
public function testSetValueFloat(
?array $preload,
string $userId,
@@ -1488,9 +1444,7 @@ class UserConfigTest extends TestCase {
];
}
- /**
- * @dataProvider providerSetValueArray
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerSetValueArray')]
public function testSetValueArray(
?array $preload,
string $userId,
@@ -1534,9 +1488,7 @@ class UserConfigTest extends TestCase {
];
}
- /**
- * @dataProvider providerUpdateSensitive
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerUpdateSensitive')]
public function testUpdateSensitive(
?array $preload,
string $userId,
@@ -1575,9 +1527,7 @@ class UserConfigTest extends TestCase {
return [[true], [false]];
}
- /**
- * @dataProvider providerUpdateGlobalSensitive
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerUpdateGlobalSensitive')]
public function testUpdateGlobalSensitive(bool $sensitive): void {
$userConfig = $this->generateUserConfig($preload ?? []);
$app = 'app2';
@@ -1624,9 +1574,7 @@ class UserConfigTest extends TestCase {
];
}
- /**
- * @dataProvider providerUpdateLazy
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerUpdateLazy')]
public function testUpdateLazy(
?array $preload,
string $userId,
@@ -1658,9 +1606,7 @@ class UserConfigTest extends TestCase {
return [[true], [false]];
}
- /**
- * @dataProvider providerUpdateGlobalLazy
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerUpdateGlobalLazy')]
public function testUpdateGlobalLazy(bool $lazy): void {
$userConfig = $this->generateUserConfig($preload ?? []);
$app = 'app2';
@@ -1728,9 +1674,7 @@ class UserConfigTest extends TestCase {
];
}
- /**
- * @dataProvider providerGetDetails
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerGetDetails')]
public function testGetDetails(string $userId, string $app, string $key, array $result): void {
$userConfig = $this->generateUserConfig($preload ?? []);
$this->assertEqualsCanonicalizing($result, $userConfig->getDetails($userId, $app, $key));
@@ -1748,9 +1692,7 @@ class UserConfigTest extends TestCase {
];
}
- /**
- * @dataProvider providerDeletePreference
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerDeletePreference')]
public function testDeletePreference(
?array $preload,
string $userId,
@@ -1779,9 +1721,7 @@ class UserConfigTest extends TestCase {
];
}
- /**
- * @dataProvider providerDeleteKey
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerDeleteKey')]
public function testDeleteKey(
?array $preload,
string $app,
diff --git a/tests/lib/Contacts/ContactsMenu/Providers/LocalTimeProviderTest.php b/tests/lib/Contacts/ContactsMenu/Providers/LocalTimeProviderTest.php
index 198ec6c672e..cc53c0bcfcf 100644
--- a/tests/lib/Contacts/ContactsMenu/Providers/LocalTimeProviderTest.php
+++ b/tests/lib/Contacts/ContactsMenu/Providers/LocalTimeProviderTest.php
@@ -110,9 +110,7 @@ class LocalTimeProviderTest extends TestCase {
];
}
- /**
- * @dataProvider dataTestProcess
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestProcess')]
public function testProcess(bool $hasCurrentUser, ?string $currentUserTZ, ?string $targetUserTZ, string $expected): void {
$entry = $this->createMock(IEntry::class);
$entry->expects($this->once())
diff --git a/tests/lib/ContactsManagerTest.php b/tests/lib/ContactsManagerTest.php
index 378dc6eadde..d2d46ce43b4 100644
--- a/tests/lib/ContactsManagerTest.php
+++ b/tests/lib/ContactsManagerTest.php
@@ -65,9 +65,7 @@ class ContactsManagerTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider searchProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('searchProvider')]
public function testSearch($search1, $search2, $expectedResult): void {
/** @var \PHPUnit\Framework\MockObject\MockObject|IAddressBook $addressbook */
$addressbook1 = $this->getMockBuilder('\OCP\IAddressBookEnabled')
@@ -109,9 +107,7 @@ class ContactsManagerTest extends \Test\TestCase {
$this->assertEquals($expectedResult, $result);
}
- /**
- * @dataProvider searchProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('searchProvider')]
public function testSearchDisabledAb($search1): void {
/** @var \PHPUnit\Framework\MockObject\MockObject|IAddressBookEnabled $addressbook */
$addressbook1 = $this->getMockBuilder('\OCP\IAddressBookEnabled')
diff --git a/tests/lib/DB/ConnectionFactoryTest.php b/tests/lib/DB/ConnectionFactoryTest.php
index fe744cf1791..d09a83ca856 100644
--- a/tests/lib/DB/ConnectionFactoryTest.php
+++ b/tests/lib/DB/ConnectionFactoryTest.php
@@ -28,10 +28,10 @@ class ConnectionFactoryTest extends TestCase {
}
/**
- * @dataProvider splitHostFromPortAndSocketData
* @param string $host
* @param array $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('splitHostFromPortAndSocketData')]
public function testSplitHostFromPortAndSocket($host, array $expected): void {
/** @var SystemConfig $config */
$config = $this->createMock(SystemConfig::class);
diff --git a/tests/lib/DB/Exception/DbalExceptionTest.php b/tests/lib/DB/Exception/DbalExceptionTest.php
index c37e65aea0e..eac74291749 100644
--- a/tests/lib/DB/Exception/DbalExceptionTest.php
+++ b/tests/lib/DB/Exception/DbalExceptionTest.php
@@ -35,10 +35,10 @@ class DbalExceptionTest extends \Test\TestCase {
}
/**
- * @dataProvider dataDriverException
* @param string $class
* @param int $reason
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataDriverException')]
public function testDriverException(string $class, int $reason): void {
$result = DbalException::wrap(new $class($this->driverException, null));
$this->assertSame($reason, $result->getReason());
diff --git a/tests/lib/DB/MigrationsTest.php b/tests/lib/DB/MigrationsTest.php
index 1841be42c04..2b39b26d852 100644
--- a/tests/lib/DB/MigrationsTest.php
+++ b/tests/lib/DB/MigrationsTest.php
@@ -185,10 +185,10 @@ class MigrationsTest extends \Test\TestCase {
}
/**
- * @dataProvider dataGetMigration
* @param string $alias
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetMigration')]
public function testGetMigration($alias, $expected): void {
$this->migrationService = $this->getMockBuilder(MigrationService::class)
->onlyMethods(['getMigratedVersions', 'findMigrations'])
diff --git a/tests/lib/DB/MigratorTest.php b/tests/lib/DB/MigratorTest.php
index 26b0e000cf6..9d8ee6791a9 100644
--- a/tests/lib/DB/MigratorTest.php
+++ b/tests/lib/DB/MigratorTest.php
@@ -279,13 +279,13 @@ class MigratorTest extends \Test\TestCase {
}
/**
- * @dataProvider dataNotNullEmptyValuesFailOracle
*
* @param int $parameterType
* @param bool|int|string $value
* @param string $columnType
* @param bool $oracleThrows
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataNotNullEmptyValuesFailOracle')]
public function testNotNullEmptyValuesFailOracle(int $parameterType, $value, string $columnType, bool $oracleThrows): void {
$startSchema = new Schema([], [], $this->getSchemaConfig());
$table = $startSchema->createTable($this->tableName);
diff --git a/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php b/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php
index 23e16258ea7..153993f396e 100644
--- a/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php
+++ b/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php
@@ -20,7 +20,7 @@ use Test\TestCase;
* @group DB
*/
class ExpressionBuilderDBTest extends TestCase {
- /** @var \Doctrine\DBAL\Connection|\OCP\IDBConnection */
+ /** @var \Doctrine\DBAL\Connection|IDBConnection */
protected $connection;
protected $schemaSetup = false;
@@ -48,12 +48,12 @@ class ExpressionBuilderDBTest extends TestCase {
}
/**
- * @dataProvider likeProvider
*
* @param string $param1
* @param string $param2
* @param boolean $match
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('likeProvider')]
public function testLike($param1, $param2, $match): void {
$query = $this->connection->getQueryBuilder();
@@ -85,12 +85,12 @@ class ExpressionBuilderDBTest extends TestCase {
}
/**
- * @dataProvider ilikeProvider
*
* @param string $param1
* @param string $param2
* @param boolean $match
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('ilikeProvider')]
public function testILike($param1, $param2, $match): void {
$query = $this->connection->getQueryBuilder();
diff --git a/tests/lib/DB/QueryBuilder/ExpressionBuilderTest.php b/tests/lib/DB/QueryBuilder/ExpressionBuilderTest.php
index 220a1430873..1f84ebfbec1 100644
--- a/tests/lib/DB/QueryBuilder/ExpressionBuilderTest.php
+++ b/tests/lib/DB/QueryBuilder/ExpressionBuilderTest.php
@@ -30,7 +30,7 @@ class ExpressionBuilderTest extends TestCase {
/** @var DoctrineExpressionBuilder */
protected $doctrineExpressionBuilder;
- /** @var \OCP\IDBConnection */
+ /** @var IDBConnection */
protected $connection;
/** @var \Doctrine\DBAL\Connection */
@@ -67,7 +67,6 @@ class ExpressionBuilderTest extends TestCase {
}
/**
- * @dataProvider dataComparison
*
* @param string $comparison
* @param mixed $input1
@@ -75,6 +74,7 @@ class ExpressionBuilderTest extends TestCase {
* @param mixed $input2
* @param bool $isInput2Literal
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataComparison')]
public function testComparison($comparison, $input1, $isInput1Literal, $input2, $isInput2Literal): void {
[$doctrineInput1, $ocInput1] = $this->helpWithLiteral($input1, $isInput1Literal);
[$doctrineInput2, $ocInput2] = $this->helpWithLiteral($input2, $isInput2Literal);
@@ -95,13 +95,13 @@ class ExpressionBuilderTest extends TestCase {
}
/**
- * @dataProvider dataComparisons
*
* @param mixed $input1
* @param bool $isInput1Literal
* @param mixed $input2
* @param bool $isInput2Literal
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataComparisons')]
public function testEquals($input1, $isInput1Literal, $input2, $isInput2Literal): void {
[$doctrineInput1, $ocInput1] = $this->helpWithLiteral($input1, $isInput1Literal);
[$doctrineInput2, $ocInput2] = $this->helpWithLiteral($input2, $isInput2Literal);
@@ -113,13 +113,13 @@ class ExpressionBuilderTest extends TestCase {
}
/**
- * @dataProvider dataComparisons
*
* @param mixed $input1
* @param bool $isInput1Literal
* @param mixed $input2
* @param bool $isInput2Literal
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataComparisons')]
public function testNotEquals($input1, $isInput1Literal, $input2, $isInput2Literal): void {
[$doctrineInput1, $ocInput1] = $this->helpWithLiteral($input1, $isInput1Literal);
[$doctrineInput2, $ocInput2] = $this->helpWithLiteral($input2, $isInput2Literal);
@@ -131,13 +131,13 @@ class ExpressionBuilderTest extends TestCase {
}
/**
- * @dataProvider dataComparisons
*
* @param mixed $input1
* @param bool $isInput1Literal
* @param mixed $input2
* @param bool $isInput2Literal
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataComparisons')]
public function testLowerThan($input1, $isInput1Literal, $input2, $isInput2Literal): void {
[$doctrineInput1, $ocInput1] = $this->helpWithLiteral($input1, $isInput1Literal);
[$doctrineInput2, $ocInput2] = $this->helpWithLiteral($input2, $isInput2Literal);
@@ -149,13 +149,13 @@ class ExpressionBuilderTest extends TestCase {
}
/**
- * @dataProvider dataComparisons
*
* @param mixed $input1
* @param bool $isInput1Literal
* @param mixed $input2
* @param bool $isInput2Literal
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataComparisons')]
public function testLowerThanEquals($input1, $isInput1Literal, $input2, $isInput2Literal): void {
[$doctrineInput1, $ocInput1] = $this->helpWithLiteral($input1, $isInput1Literal);
[$doctrineInput2, $ocInput2] = $this->helpWithLiteral($input2, $isInput2Literal);
@@ -167,13 +167,13 @@ class ExpressionBuilderTest extends TestCase {
}
/**
- * @dataProvider dataComparisons
*
* @param mixed $input1
* @param bool $isInput1Literal
* @param mixed $input2
* @param bool $isInput2Literal
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataComparisons')]
public function testGreaterThan($input1, $isInput1Literal, $input2, $isInput2Literal): void {
[$doctrineInput1, $ocInput1] = $this->helpWithLiteral($input1, $isInput1Literal);
[$doctrineInput2, $ocInput2] = $this->helpWithLiteral($input2, $isInput2Literal);
@@ -185,13 +185,13 @@ class ExpressionBuilderTest extends TestCase {
}
/**
- * @dataProvider dataComparisons
*
* @param mixed $input1
* @param bool $isInput1Literal
* @param mixed $input2
* @param bool $isInput2Literal
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataComparisons')]
public function testGreaterThanEquals($input1, $isInput1Literal, $input2, $isInput2Literal): void {
[$doctrineInput1, $ocInput1] = $this->helpWithLiteral($input1, $isInput1Literal);
[$doctrineInput2, $ocInput2] = $this->helpWithLiteral($input2, $isInput2Literal);
@@ -224,11 +224,11 @@ class ExpressionBuilderTest extends TestCase {
}
/**
- * @dataProvider dataLike
*
* @param mixed $input
* @param bool $isLiteral
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataLike')]
public function testLike($input, $isLiteral): void {
[$doctrineInput, $ocInput] = $this->helpWithLiteral($input, $isLiteral);
@@ -239,11 +239,11 @@ class ExpressionBuilderTest extends TestCase {
}
/**
- * @dataProvider dataLike
*
* @param mixed $input
* @param bool $isLiteral
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataLike')]
public function testNotLike($input, $isLiteral): void {
[$doctrineInput, $ocInput] = $this->helpWithLiteral($input, $isLiteral);
@@ -263,11 +263,11 @@ class ExpressionBuilderTest extends TestCase {
}
/**
- * @dataProvider dataIn
*
* @param mixed $input
* @param bool $isLiteral
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataIn')]
public function testIn($input, $isLiteral): void {
[$doctrineInput, $ocInput] = $this->helpWithLiteral($input, $isLiteral);
@@ -278,11 +278,11 @@ class ExpressionBuilderTest extends TestCase {
}
/**
- * @dataProvider dataIn
*
* @param mixed $input
* @param bool $isLiteral
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataIn')]
public function testNotIn($input, $isLiteral): void {
[$doctrineInput, $ocInput] = $this->helpWithLiteral($input, $isLiteral);
@@ -332,11 +332,11 @@ class ExpressionBuilderTest extends TestCase {
}
/**
- * @dataProvider dataLiteral
*
* @param mixed $input
* @param string|null $type
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataLiteral')]
public function testLiteral($input, $type): void {
/** @var \OC\DB\QueryBuilder\Literal $actual */
$actual = $this->expressionBuilder->literal($input, $type);
@@ -376,13 +376,13 @@ class ExpressionBuilderTest extends TestCase {
}
/**
- * @dataProvider dataClobComparisons
* @param string $function
* @param mixed $value
* @param mixed $type
* @param bool $compareKeyToValue
* @param int $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataClobComparisons')]
public function testClobComparisons($function, $value, $type, $compareKeyToValue, $expected): void {
$appId = $this->getUniqueID('testing');
$this->createConfig($appId, 1, 4);
diff --git a/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php b/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php
index 9506b74ce7b..fc20af8a841 100644
--- a/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php
+++ b/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php
@@ -21,7 +21,7 @@ use Test\TestCase;
* @package Test\DB\QueryBuilder
*/
class FunctionBuilderTest extends TestCase {
- /** @var \Doctrine\DBAL\Connection|\OCP\IDBConnection */
+ /** @var \Doctrine\DBAL\Connection|IDBConnection */
protected $connection;
protected function setUp(): void {
@@ -30,9 +30,7 @@ class FunctionBuilderTest extends TestCase {
$this->connection = Server::get(IDBConnection::class);
}
- /**
- * @dataProvider providerTestConcatString
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providerTestConcatString')]
public function testConcatString($closure): void {
$query = $this->connection->getQueryBuilder();
[$real, $arguments, $return] = $closure($query);
@@ -335,9 +333,7 @@ class FunctionBuilderTest extends TestCase {
];
}
- /**
- * @dataProvider octetLengthProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('octetLengthProvider')]
public function testOctetLength(string $str, int $bytes): void {
$query = $this->connection->getQueryBuilder();
@@ -360,9 +356,7 @@ class FunctionBuilderTest extends TestCase {
];
}
- /**
- * @dataProvider charLengthProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('charLengthProvider')]
public function testCharLength(string $str, int $bytes): void {
$query = $this->connection->getQueryBuilder();
diff --git a/tests/lib/DB/QueryBuilder/Partitioned/JoinConditionTest.php b/tests/lib/DB/QueryBuilder/Partitioned/JoinConditionTest.php
index 3d34ad389bc..8f84d6a0d2c 100644
--- a/tests/lib/DB/QueryBuilder/Partitioned/JoinConditionTest.php
+++ b/tests/lib/DB/QueryBuilder/Partitioned/JoinConditionTest.php
@@ -41,9 +41,7 @@ class JoinConditionTest extends TestCase {
);
}
- /**
- * @dataProvider platformProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('platformProvider')]
public function testParseCondition(string $platform): void {
$query = $this->getBuilder($platform);
$param1 = $query->createNamedParameter('files');
@@ -63,9 +61,7 @@ class JoinConditionTest extends TestCase {
], $parsed->toConditions);
}
- /**
- * @dataProvider platformProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('platformProvider')]
public function testParseCastCondition(string $platform): void {
$query = $this->getBuilder($platform);
diff --git a/tests/lib/DB/QueryBuilder/QueryBuilderTest.php b/tests/lib/DB/QueryBuilder/QueryBuilderTest.php
index 538ec637099..990191a9ff5 100644
--- a/tests/lib/DB/QueryBuilder/QueryBuilderTest.php
+++ b/tests/lib/DB/QueryBuilder/QueryBuilderTest.php
@@ -100,11 +100,11 @@ class QueryBuilderTest extends \Test\TestCase {
}
/**
- * @dataProvider dataFirstResult
*
* @param int|null $firstResult
* @param array $expectedSet
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataFirstResult')]
public function testFirstResult($firstResult, $expectedSet): void {
$this->deleteTestingRows();
$this->createTestingRows();
@@ -137,11 +137,11 @@ class QueryBuilderTest extends \Test\TestCase {
}
/**
- * @dataProvider dataMaxResults
*
* @param int $maxResult
* @param array $expectedSet
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataMaxResults')]
public function testMaxResults($maxResult, $expectedSet): void {
$this->deleteTestingRows();
$this->createTestingRows();
@@ -189,12 +189,12 @@ class QueryBuilderTest extends \Test\TestCase {
}
/**
- * @dataProvider dataSelect
*
* @param array $selectArguments
* @param array $expected
* @param string $expectedLiteral
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSelect')]
public function testSelect($selectArguments, $expected, $expectedLiteral = ''): void {
$this->deleteTestingRows();
$this->createTestingRows();
@@ -242,12 +242,12 @@ class QueryBuilderTest extends \Test\TestCase {
}
/**
- * @dataProvider dataSelectAlias
*
* @param mixed $select
* @param array $alias
* @param array $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSelectAlias')]
public function testSelectAlias($select, $alias, $expected): void {
$this->deleteTestingRows();
$this->createTestingRows();
@@ -366,12 +366,12 @@ class QueryBuilderTest extends \Test\TestCase {
}
/**
- * @dataProvider dataAddSelect
*
* @param array $selectArguments
* @param array $expected
* @param string $expectedLiteral
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataAddSelect')]
public function testAddSelect($selectArguments, $expected, $expectedLiteral = ''): void {
$this->deleteTestingRows();
$this->createTestingRows();
@@ -418,13 +418,13 @@ class QueryBuilderTest extends \Test\TestCase {
}
/**
- * @dataProvider dataDelete
*
* @param string $tableName
* @param string $tableAlias
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataDelete')]
public function testDelete($tableName, $tableAlias, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->delete($tableName, $tableAlias);
@@ -447,13 +447,13 @@ class QueryBuilderTest extends \Test\TestCase {
}
/**
- * @dataProvider dataUpdate
*
* @param string $tableName
* @param string $tableAlias
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataUpdate')]
public function testUpdate($tableName, $tableAlias, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->update($tableName, $tableAlias);
@@ -475,12 +475,12 @@ class QueryBuilderTest extends \Test\TestCase {
}
/**
- * @dataProvider dataInsert
*
* @param string $tableName
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataInsert')]
public function testInsert($tableName, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->insert($tableName);
@@ -517,7 +517,6 @@ class QueryBuilderTest extends \Test\TestCase {
}
/**
- * @dataProvider dataFrom
*
* @param string|IQueryFunction $table1Name
* @param string $table1Alias
@@ -526,6 +525,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataFrom')]
public function testFrom($table1Name, $table1Alias, $table2Name, $table2Alias, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->from($table1Name, $table1Alias);
if ($table2Name !== null) {
@@ -565,7 +565,6 @@ class QueryBuilderTest extends \Test\TestCase {
}
/**
- * @dataProvider dataJoin
*
* @param string $fromAlias
* @param string $tableName
@@ -574,6 +573,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataJoin')]
public function testJoin($fromAlias, $tableName, $tableAlias, $condition, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->from('data1', 'd1');
$this->queryBuilder->join(
@@ -595,7 +595,6 @@ class QueryBuilderTest extends \Test\TestCase {
}
/**
- * @dataProvider dataJoin
*
* @param string $fromAlias
* @param string $tableName
@@ -604,6 +603,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataJoin')]
public function testInnerJoin($fromAlias, $tableName, $tableAlias, $condition, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->from('data1', 'd1');
$this->queryBuilder->innerJoin(
@@ -645,7 +645,6 @@ class QueryBuilderTest extends \Test\TestCase {
}
/**
- * @dataProvider dataLeftJoin
*
* @param string $fromAlias
* @param string $tableName
@@ -654,6 +653,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataLeftJoin')]
public function testLeftJoin($fromAlias, $tableName, $tableAlias, $condition, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->from('data1', 'd1');
$this->queryBuilder->leftJoin(
@@ -695,7 +695,6 @@ class QueryBuilderTest extends \Test\TestCase {
}
/**
- * @dataProvider dataRightJoin
*
* @param string $fromAlias
* @param string $tableName
@@ -704,6 +703,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataRightJoin')]
public function testRightJoin($fromAlias, $tableName, $tableAlias, $condition, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->from('data1', 'd1');
$this->queryBuilder->rightJoin(
@@ -734,7 +734,6 @@ class QueryBuilderTest extends \Test\TestCase {
}
/**
- * @dataProvider dataSet
*
* @param string $partOne1
* @param string $partOne2
@@ -743,6 +742,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSet')]
public function testSet($partOne1, $partOne2, $partTwo1, $partTwo2, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->update('data');
$this->queryBuilder->set($partOne1, $partOne2);
@@ -769,12 +769,12 @@ class QueryBuilderTest extends \Test\TestCase {
}
/**
- * @dataProvider dataWhere
*
* @param array $whereArguments
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataWhere')]
public function testWhere($whereArguments, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->select('column');
call_user_func_array(
@@ -794,12 +794,12 @@ class QueryBuilderTest extends \Test\TestCase {
}
/**
- * @dataProvider dataWhere
*
* @param array $whereArguments
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataWhere')]
public function testAndWhere($whereArguments, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->select('column');
call_user_func_array(
@@ -826,12 +826,12 @@ class QueryBuilderTest extends \Test\TestCase {
}
/**
- * @dataProvider dataOrWhere
*
* @param array $whereArguments
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataOrWhere')]
public function testOrWhere($whereArguments, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->select('column');
call_user_func_array(
@@ -858,12 +858,12 @@ class QueryBuilderTest extends \Test\TestCase {
}
/**
- * @dataProvider dataGroupBy
*
* @param array $groupByArguments
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGroupBy')]
public function testGroupBy($groupByArguments, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->select('column');
call_user_func_array(
@@ -890,12 +890,12 @@ class QueryBuilderTest extends \Test\TestCase {
}
/**
- * @dataProvider dataAddGroupBy
*
* @param array $groupByArguments
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataAddGroupBy')]
public function testAddGroupBy($groupByArguments, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->select('column');
$this->queryBuilder->groupBy('column1');
@@ -922,13 +922,13 @@ class QueryBuilderTest extends \Test\TestCase {
}
/**
- * @dataProvider dataSetValue
*
* @param string $column
* @param string $value
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetValue')]
public function testSetValue($column, $value, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->insert('data');
$this->queryBuilder->setValue($column, $value);
@@ -945,13 +945,13 @@ class QueryBuilderTest extends \Test\TestCase {
}
/**
- * @dataProvider dataSetValue
*
* @param string $column
* @param string $value
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetValue')]
public function testValues($column, $value, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->insert('data');
$this->queryBuilder->values([
@@ -987,12 +987,12 @@ class QueryBuilderTest extends \Test\TestCase {
}
/**
- * @dataProvider dataHaving
*
* @param array $havingArguments
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataHaving')]
public function testHaving($havingArguments, $expectedQueryPart, $expectedQuery): void {
call_user_func_array(
[$this->queryBuilder, 'having'],
@@ -1028,12 +1028,12 @@ class QueryBuilderTest extends \Test\TestCase {
}
/**
- * @dataProvider dataAndHaving
*
* @param array $havingArguments
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataAndHaving')]
public function testAndHaving($havingArguments, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->having('condition1');
call_user_func_array(
@@ -1070,12 +1070,12 @@ class QueryBuilderTest extends \Test\TestCase {
}
/**
- * @dataProvider dataOrHaving
*
* @param array $havingArguments
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataOrHaving')]
public function testOrHaving($havingArguments, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->having('condition1');
call_user_func_array(
@@ -1103,13 +1103,13 @@ class QueryBuilderTest extends \Test\TestCase {
}
/**
- * @dataProvider dataOrderBy
*
* @param string $sort
* @param string $order
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataOrderBy')]
public function testOrderBy($sort, $order, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->orderBy($sort, $order);
@@ -1139,7 +1139,6 @@ class QueryBuilderTest extends \Test\TestCase {
}
/**
- * @dataProvider dataAddOrderBy
*
* @param string $sort2
* @param string $order2
@@ -1147,6 +1146,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataAddOrderBy')]
public function testAddOrderBy($sort2, $order2, $order1, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->orderBy('column1', $order1);
$this->queryBuilder->addOrderBy($sort2, $order2);
@@ -1219,12 +1219,12 @@ class QueryBuilderTest extends \Test\TestCase {
}
/**
- * @dataProvider dataGetTableName
*
* @param string|IQueryFunction $tableName
* @param bool $automatic
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetTableName')]
public function testGetTableName($tableName, $automatic, $expected): void {
if ($automatic !== null) {
$this->queryBuilder->automaticTablePrefix($automatic);
@@ -1244,11 +1244,11 @@ class QueryBuilderTest extends \Test\TestCase {
}
/**
- * @dataProvider dataGetColumnName
* @param string $column
* @param string $prefix
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetColumnName')]
public function testGetColumnName($column, $prefix, $expected): void {
$this->assertSame(
$expected,
diff --git a/tests/lib/DB/QueryBuilder/QuoteHelperTest.php b/tests/lib/DB/QueryBuilder/QuoteHelperTest.php
index 3238306de82..6efb55708a1 100644
--- a/tests/lib/DB/QueryBuilder/QuoteHelperTest.php
+++ b/tests/lib/DB/QueryBuilder/QuoteHelperTest.php
@@ -38,10 +38,10 @@ class QuoteHelperTest extends \Test\TestCase {
}
/**
- * @dataProvider dataQuoteColumnName
* @param mixed $input
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataQuoteColumnName')]
public function testQuoteColumnName($input, $expected): void {
$this->assertSame(
$expected,
@@ -73,10 +73,10 @@ class QuoteHelperTest extends \Test\TestCase {
}
/**
- * @dataProvider dataQuoteColumnNames
* @param mixed $input
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataQuoteColumnNames')]
public function testQuoteColumnNames($input, $expected): void {
$this->assertSame(
$expected,
diff --git a/tests/lib/DateTimeFormatterTest.php b/tests/lib/DateTimeFormatterTest.php
index 75784a50c08..dce6692f9cb 100644
--- a/tests/lib/DateTimeFormatterTest.php
+++ b/tests/lib/DateTimeFormatterTest.php
@@ -78,9 +78,7 @@ class DateTimeFormatterTest extends TestCase {
];
}
- /**
- * @dataProvider formatTimeSpanData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('formatTimeSpanData')]
public function testFormatTimeSpan($expected, $timestamp, $compare, $locale = null): void {
$this->assertEquals((string)$expected, (string)$this->formatter->formatTimeSpan($timestamp, $compare, $locale));
}
@@ -144,9 +142,7 @@ class DateTimeFormatterTest extends TestCase {
];
}
- /**
- * @dataProvider formatDateSpanData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('formatDateSpanData')]
public function testFormatDateSpan($expected, $timestamp, $compare = null, $locale = null): void {
$this->assertEquals((string)$expected, (string)$this->formatter->formatDateSpan($timestamp, $compare, $locale));
}
@@ -157,9 +153,7 @@ class DateTimeFormatterTest extends TestCase {
];
}
- /**
- * @dataProvider formatDateData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('formatDateData')]
public function testFormatDate($timestamp, $expected): void {
$this->assertEquals($expected, (string)$this->formatter->formatDate($timestamp));
}
@@ -171,9 +165,7 @@ class DateTimeFormatterTest extends TestCase {
];
}
- /**
- * @dataProvider formatDateTimeData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('formatDateTimeData')]
public function testFormatDateTime($timestamp, $timeZone, $expected): void {
$this->assertEquals($expected, (string)$this->formatter->formatDateTime($timestamp, 'long', 'long', $timeZone));
}
diff --git a/tests/lib/EmojiHelperTest.php b/tests/lib/EmojiHelperTest.php
index 517d8655e53..9a89a4b299e 100644
--- a/tests/lib/EmojiHelperTest.php
+++ b/tests/lib/EmojiHelperTest.php
@@ -27,9 +27,8 @@ class EmojiHelperTest extends TestCase {
/**
* @param bool $supports4ByteText
* @param bool $expected
- *
- * @dataProvider doesPlatformSupportEmojiDataProvider
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('doesPlatformSupportEmojiDataProvider')]
public function testDoesPlatformSupportEmoji(bool $supports4ByteText, bool $expected): void {
$this->db->expects($this->once())
->method('supports4ByteText')
@@ -48,9 +47,8 @@ class EmojiHelperTest extends TestCase {
/**
* @param string $emoji
* @param bool $expected
- *
- * @dataProvider isValidSingleEmojiDataProvider
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('isValidSingleEmojiDataProvider')]
public function testIsValidSingleEmoji(string $emoji, bool $expected): void {
$actual = $this->helper->isValidSingleEmoji($emoji);
diff --git a/tests/lib/Encryption/DecryptAllTest.php b/tests/lib/Encryption/DecryptAllTest.php
index bf7d0324b8c..979e12e03b3 100644
--- a/tests/lib/Encryption/DecryptAllTest.php
+++ b/tests/lib/Encryption/DecryptAllTest.php
@@ -45,7 +45,7 @@ class DecryptAllTest extends TestCase {
/** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Output\OutputInterface */
protected $outputInterface;
- /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\UserInterface */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|UserInterface */
protected $userInterface;
/** @var DecryptAll */
@@ -94,11 +94,11 @@ class DecryptAllTest extends TestCase {
}
/**
- * @dataProvider dataDecryptAll
* @param bool $prepareResult
* @param string $user
* @param bool $userExistsChecked
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataDecryptAll')]
public function testDecryptAll($prepareResult, $user, $userExistsChecked): void {
if ($userExistsChecked) {
$this->userManager->expects($this->once())->method('userExists')->willReturn(true);
@@ -154,9 +154,9 @@ class DecryptAllTest extends TestCase {
}
/**
- * @dataProvider dataTrueFalse
* @param bool $success
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTrueFalse')]
public function testPrepareEncryptionModules($success): void {
$user = 'user1';
@@ -186,9 +186,7 @@ class DecryptAllTest extends TestCase {
);
}
- /**
- * @dataProvider dataTestDecryptAllUsersFiles
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestDecryptAllUsersFiles')]
public function testDecryptAllUsersFiles($user): void {
/** @var DecryptAll | \PHPUnit\Framework\MockObject\MockObject | $instance */
$instance = $this->getMockBuilder('OC\Encryption\DecryptAll')
@@ -318,9 +316,7 @@ class DecryptAllTest extends TestCase {
$this->invokePrivate($instance, 'decryptUsersFiles', ['user1', $progressBar, '']);
}
- /**
- * @dataProvider dataTrueFalse
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTrueFalse')]
public function testDecryptFile($isEncrypted): void {
$path = 'test.txt';
diff --git a/tests/lib/Encryption/EncryptionWrapperTest.php b/tests/lib/Encryption/EncryptionWrapperTest.php
index 8930b62eacf..58bf5aff005 100644
--- a/tests/lib/Encryption/EncryptionWrapperTest.php
+++ b/tests/lib/Encryption/EncryptionWrapperTest.php
@@ -29,7 +29,7 @@ class EncryptionWrapperTest extends TestCase {
/** @var \PHPUnit\Framework\MockObject\MockObject | \OC\Encryption\Manager */
private $manager;
- /** @var \PHPUnit\Framework\MockObject\MockObject | \OC\Memcache\ArrayCache */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|ArrayCache */
private $arrayCache;
protected function setUp(): void {
@@ -43,9 +43,7 @@ class EncryptionWrapperTest extends TestCase {
}
- /**
- * @dataProvider provideWrapStorage
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('provideWrapStorage')]
public function testWrapStorage($expectedWrapped, $wrappedStorages): void {
$storage = $this->getMockBuilder(IStorage::class)
->disableOriginalConstructor()
diff --git a/tests/lib/Encryption/Keys/StorageTest.php b/tests/lib/Encryption/Keys/StorageTest.php
index 348b0ecf10d..333d8d8ce21 100644
--- a/tests/lib/Encryption/Keys/StorageTest.php
+++ b/tests/lib/Encryption/Keys/StorageTest.php
@@ -124,13 +124,13 @@ class StorageTest extends TestCase {
}
/**
- * @dataProvider dataTestGetFileKey
*
* @param string $path
* @param string $strippedPartialName
* @param bool $originalKeyExists
* @param string $expectedKeyContent
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetFileKey')]
public function testGetFileKey($path, $strippedPartialName, $originalKeyExists, $expectedKeyContent): void {
$this->config->method('getSystemValueString')
->with('version')
@@ -408,9 +408,7 @@ class StorageTest extends TestCase {
);
}
- /**
- * @dataProvider dataProviderCopyRename
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataProviderCopyRename')]
public function testRenameKeys($source, $target, $systemWideMountSource, $systemWideMountTarget, $expectedSource, $expectedTarget): void {
$this->view->expects($this->any())
->method('file_exists')
@@ -439,9 +437,7 @@ class StorageTest extends TestCase {
$this->storage->renameKeys($source, $target);
}
- /**
- * @dataProvider dataProviderCopyRename
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataProviderCopyRename')]
public function testCopyKeys($source, $target, $systemWideMountSource, $systemWideMountTarget, $expectedSource, $expectedTarget): void {
$this->view->expects($this->any())
->method('file_exists')
@@ -510,13 +506,13 @@ class StorageTest extends TestCase {
}
/**
- * @dataProvider dataTestGetPathToKeys
*
* @param string $path
* @param boolean $systemWideMountPoint
* @param string $storageRoot
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetPathToKeys')]
public function testGetPathToKeys($path, $systemWideMountPoint, $storageRoot, $expected): void {
$this->invokePrivate($this->storage, 'root_dir', [$storageRoot]);
@@ -569,9 +565,9 @@ class StorageTest extends TestCase {
/**
- * @dataProvider dataTestBackupUserKeys
* @param bool $createBackupDir
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestBackupUserKeys')]
public function testBackupUserKeys($createBackupDir): void {
$storage = $this->getMockBuilder('OC\Encryption\Keys\Storage')
->setConstructorArgs([$this->view, $this->util, $this->crypto, $this->config])
diff --git a/tests/lib/Encryption/ManagerTest.php b/tests/lib/Encryption/ManagerTest.php
index 5e158a2b82e..e9b6ddae8a0 100644
--- a/tests/lib/Encryption/ManagerTest.php
+++ b/tests/lib/Encryption/ManagerTest.php
@@ -266,7 +266,7 @@ class ManagerTest extends TestCase {
$encryptionModule->expects($this->any())
->method('getDisplayName')
->willReturn('TestDummyModule' . $id);
- /** @var \OCP\Encryption\IEncryptionModule $encryptionModule */
+ /** @var IEncryptionModule $encryptionModule */
$manager->registerEncryptionModule('ID' . $id, 'TestDummyModule' . $id, function () use ($encryptionModule) {
return $encryptionModule;
});
diff --git a/tests/lib/Encryption/UpdateTest.php b/tests/lib/Encryption/UpdateTest.php
index 4f3de2b495d..04ca224c0a1 100644
--- a/tests/lib/Encryption/UpdateTest.php
+++ b/tests/lib/Encryption/UpdateTest.php
@@ -77,13 +77,13 @@ class UpdateTest extends TestCase {
}
/**
- * @dataProvider dataTestUpdate
*
* @param string $path
* @param boolean $isDir
* @param array $allFiles
* @param integer $numberOfFiles
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestUpdate')]
public function testUpdate($path, $isDir, $allFiles, $numberOfFiles): void {
$updateMock = $this->getUpdateMock(['getOwnerPath']);
$updateMock->expects($this->once())->method('getOwnerPath')
@@ -121,11 +121,11 @@ class UpdateTest extends TestCase {
}
/**
- * @dataProvider dataTestPostRename
*
* @param string $source
* @param string $target
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestPostRename')]
public function testPostRename($source, $target): void {
$updateMock = $this->getUpdateMock(['update','getOwnerPath']);
diff --git a/tests/lib/Encryption/UtilTest.php b/tests/lib/Encryption/UtilTest.php
index db74eef0f16..d1fefee872a 100644
--- a/tests/lib/Encryption/UtilTest.php
+++ b/tests/lib/Encryption/UtilTest.php
@@ -55,9 +55,7 @@ class UtilTest extends TestCase {
);
}
- /**
- * @dataProvider providesHeadersForEncryptionModule
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providesHeadersForEncryptionModule')]
public function testGetEncryptionModuleId($expected, $header): void {
$id = $this->util->getEncryptionModuleId($header);
$this->assertEquals($expected, $id);
@@ -71,9 +69,7 @@ class UtilTest extends TestCase {
];
}
- /**
- * @dataProvider providesHeaders
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providesHeaders')]
public function testCreateHeader($expected, $header, $moduleId): void {
$em = $this->createMock(IEncryptionModule::class);
$em->expects($this->any())->method('getId')->willReturn($moduleId);
@@ -104,9 +100,7 @@ class UtilTest extends TestCase {
$this->util->createHeader($header, $em);
}
- /**
- * @dataProvider providePathsForTestIsExcluded
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providePathsForTestIsExcluded')]
public function testIsExcluded($path, $keyStorageRoot, $expected): void {
$this->config->expects($this->once())
->method('getAppValue')
@@ -145,9 +139,7 @@ class UtilTest extends TestCase {
return false;
}
- /**
- * @dataProvider dataTestIsFile
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestIsFile')]
public function testIsFile($path, $expected): void {
$this->assertSame($expected,
$this->util->isFile($path)
@@ -167,11 +159,11 @@ class UtilTest extends TestCase {
}
/**
- * @dataProvider dataTestStripPartialFileExtension
*
* @param string $path
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestStripPartialFileExtension')]
public function testStripPartialFileExtension($path, $expected): void {
$this->assertSame($expected,
$this->util->stripPartialFileExtension($path));
@@ -186,9 +178,7 @@ class UtilTest extends TestCase {
];
}
- /**
- * @dataProvider dataTestParseRawHeader
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestParseRawHeader')]
public function testParseRawHeader($rawHeader, $expected): void {
$result = $this->util->parseRawHeader($rawHeader);
$this->assertSameSize($expected, $result);
@@ -214,12 +204,12 @@ class UtilTest extends TestCase {
}
/**
- * @dataProvider dataTestGetFileKeyDir
*
* @param bool $isSystemWideMountPoint
* @param string $storageRoot
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetFileKeyDir')]
public function testGetFileKeyDir($isSystemWideMountPoint, $storageRoot, $expected): void {
$path = '/user1/files/foo/bar.txt';
$owner = 'user1';
diff --git a/tests/lib/ErrorHandlerTest.php b/tests/lib/ErrorHandlerTest.php
index 00cf8e4c8db..0bec3445d34 100644
--- a/tests/lib/ErrorHandlerTest.php
+++ b/tests/lib/ErrorHandlerTest.php
@@ -55,10 +55,10 @@ class ErrorHandlerTest extends TestCase {
}
/**
- * @dataProvider passwordProvider
* @param string $username
* @param string $password
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('passwordProvider')]
public function testRemovePasswordFromError($username, $password): void {
$url = 'http://' . $username . ':' . $password . '@owncloud.org';
$expectedResult = 'http://xxx:xxx@owncloud.org';
diff --git a/tests/lib/Federation/CloudIdManagerTest.php b/tests/lib/Federation/CloudIdManagerTest.php
index 0bd0659b2f2..3bd3cf6149d 100644
--- a/tests/lib/Federation/CloudIdManagerTest.php
+++ b/tests/lib/Federation/CloudIdManagerTest.php
@@ -65,9 +65,7 @@ class CloudIdManagerTest extends TestCase {
];
}
- /**
- * @dataProvider dataGetDisplayNameFromContact
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetDisplayNameFromContact')]
public function testGetDisplayNameFromContact(string $cloudId, ?string $displayName, ?string $expected): void {
$returnedContact = [
'CLOUD' => [$cloudId],
@@ -98,9 +96,7 @@ class CloudIdManagerTest extends TestCase {
];
}
- /**
- * @dataProvider cloudIdProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('cloudIdProvider')]
public function testResolveCloudId(string $cloudId, string $user, string $noProtocolRemote, string $cleanId): void {
$displayName = 'Ample Ex';
@@ -130,9 +126,7 @@ class CloudIdManagerTest extends TestCase {
];
}
- /**
- * @dataProvider invalidCloudIdProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('invalidCloudIdProvider')]
public function testInvalidCloudId(string $cloudId): void {
$this->expectException(\InvalidArgumentException::class);
@@ -154,9 +148,7 @@ class CloudIdManagerTest extends TestCase {
];
}
- /**
- * @dataProvider getCloudIdProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('getCloudIdProvider')]
public function testGetCloudId(string $user, ?string $remote, string $id, ?string $searchCloudId = null, ?string $localHost = 'https://example.com', ?string $expectedRemoteId = null): void {
if ($remote !== null) {
$this->contactsManager->expects($this->any())
diff --git a/tests/lib/Federation/CloudIdTest.php b/tests/lib/Federation/CloudIdTest.php
index ec3cc15d6ff..67683861e40 100644
--- a/tests/lib/Federation/CloudIdTest.php
+++ b/tests/lib/Federation/CloudIdTest.php
@@ -37,9 +37,7 @@ class CloudIdTest extends TestCase {
];
}
- /**
- * @dataProvider dataGetDisplayCloudId
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetDisplayCloudId')]
public function testGetDisplayCloudId(string $id, string $user, string $remote, string $display, ?string $addressbookName = null): void {
$this->cloudIdManager->expects($this->once())
->method('getDisplayNameFromContact')
diff --git a/tests/lib/Files/Cache/CacheTest.php b/tests/lib/Files/Cache/CacheTest.php
index 7c736ab0266..383962b7224 100644
--- a/tests/lib/Files/Cache/CacheTest.php
+++ b/tests/lib/Files/Cache/CacheTest.php
@@ -38,20 +38,20 @@ class LongId extends Temporary {
*/
class CacheTest extends \Test\TestCase {
/**
- * @var \OC\Files\Storage\Temporary $storage ;
+ * @var Temporary $storage ;
*/
protected $storage;
/**
- * @var \OC\Files\Storage\Temporary $storage2 ;
+ * @var Temporary $storage2 ;
*/
protected $storage2;
/**
- * @var \OC\Files\Cache\Cache $cache
+ * @var Cache $cache
*/
protected $cache;
/**
- * @var \OC\Files\Cache\Cache $cache2
+ * @var Cache $cache2
*/
protected $cache2;
@@ -162,9 +162,7 @@ class CacheTest extends \Test\TestCase {
$this->assertEquals(new CacheEntry(['size' => 12, 'mtime' => 15]), $this->cache->get($file1));
}
- /**
- * @dataProvider folderDataProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('folderDataProvider')]
public function testFolder($folder): void {
if (strpos($folder, 'F09F9890')) {
// 4 byte UTF doesn't work on mysql
@@ -335,9 +333,9 @@ class CacheTest extends \Test\TestCase {
}
/**
- * @dataProvider putWithAllKindOfQuotesData
* @param $fileName
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('putWithAllKindOfQuotesData')]
public function testPutWithAllKindOfQuotes($fileName): void {
$this->assertEquals(Cache::NOT_FOUND, $this->cache->get($fileName));
$this->cache->put($fileName, ['size' => 20, 'mtime' => 25, 'mimetype' => 'foo/file', 'etag' => $fileName]);
@@ -470,9 +468,7 @@ class CacheTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider movePathProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('movePathProvider')]
public function testMove($sourceFolder, $targetFolder, $children): void {
$data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'foo/bar'];
$folderData = ['size' => 100, 'mtime' => 50, 'mimetype' => ICacheEntry::DIRECTORY_MIMETYPE];
@@ -597,7 +593,7 @@ class CacheTest extends \Test\TestCase {
$folderWith0308 = "\x53\x63\x68\x6f\xcc\x88\x6e";
/**
- * @var \OC\Files\Cache\Cache | \PHPUnit\Framework\MockObject\MockObject $cacheMock
+ * @var Cache|\PHPUnit\Framework\MockObject\MockObject $cacheMock
*/
$cacheMock = $this->getMockBuilder(Cache::class)
->onlyMethods(['normalize'])
@@ -682,9 +678,8 @@ class CacheTest extends \Test\TestCase {
/**
* Test bogus paths with leading or doubled slashes
- *
- * @dataProvider bogusPathNamesProvider
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('bogusPathNamesProvider')]
public function testBogusPaths($bogusPath, $fixedBogusPath): void {
$data = ['size' => 100, 'mtime' => 50, 'mimetype' => ICacheEntry::DIRECTORY_MIMETYPE];
$parentId = $this->cache->getId('');
@@ -726,8 +721,8 @@ class CacheTest extends \Test\TestCase {
/**
* @param string $name
- * @dataProvider escapingProvider
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('escapingProvider')]
public function testEscaping($name): void {
$data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain'];
$this->cache->put($name, $data);
diff --git a/tests/lib/Files/Cache/HomeCacheTest.php b/tests/lib/Files/Cache/HomeCacheTest.php
index fd2cfcc0d3c..86fda615fd7 100644
--- a/tests/lib/Files/Cache/HomeCacheTest.php
+++ b/tests/lib/Files/Cache/HomeCacheTest.php
@@ -58,7 +58,7 @@ class HomeCacheTest extends \Test\TestCase {
private $cache;
/**
- * @var \OC\User\User $user
+ * @var User $user
*/
private $user;
diff --git a/tests/lib/Files/Cache/ScannerTest.php b/tests/lib/Files/Cache/ScannerTest.php
index 287216f387d..123c13893f7 100644
--- a/tests/lib/Files/Cache/ScannerTest.php
+++ b/tests/lib/Files/Cache/ScannerTest.php
@@ -386,11 +386,11 @@ class ScannerTest extends TestCase {
}
/**
- * @dataProvider dataTestIsPartialFile
*
* @param string $path
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestIsPartialFile')]
public function testIsPartialFile($path, $expected): void {
$this->assertSame($expected,
$this->scanner->isPartialFile($path)
diff --git a/tests/lib/Files/Cache/SearchBuilderTest.php b/tests/lib/Files/Cache/SearchBuilderTest.php
index 9061f128370..ee097044e3b 100644
--- a/tests/lib/Files/Cache/SearchBuilderTest.php
+++ b/tests/lib/Files/Cache/SearchBuilderTest.php
@@ -178,11 +178,11 @@ class SearchBuilderTest extends TestCase {
}
/**
- * @dataProvider comparisonProvider
*
* @param ISearchOperator $operator
* @param array $fileIds
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('comparisonProvider')]
public function testComparison(ISearchOperator $operator, array $fileIds): void {
$fileId = [];
$fileId[] = $this->addCacheEntry([
diff --git a/tests/lib/Files/Cache/UpdaterLegacyTest.php b/tests/lib/Files/Cache/UpdaterLegacyTest.php
index 9724934b309..c71fac2d2dc 100644
--- a/tests/lib/Files/Cache/UpdaterLegacyTest.php
+++ b/tests/lib/Files/Cache/UpdaterLegacyTest.php
@@ -8,7 +8,10 @@
namespace Test\Files\Cache;
+use OC\Files\Cache\Cache;
+use OC\Files\Cache\Scanner;
use OC\Files\Filesystem as Filesystem;
+use OC\Files\Storage\Storage;
use OC\Files\Storage\Temporary;
use OC\Files\View;
use OCP\Files\Mount\IMountManager;
@@ -24,17 +27,17 @@ use OCP\Server;
*/
class UpdaterLegacyTest extends \Test\TestCase {
/**
- * @var \OC\Files\Storage\Storage $storage
+ * @var Storage $storage
*/
private $storage;
/**
- * @var \OC\Files\Cache\Scanner $scanner
+ * @var Scanner $scanner
*/
private $scanner;
/**
- * @var \OC\Files\Cache\Cache $cache
+ * @var Cache $cache
*/
private $cache;
diff --git a/tests/lib/Files/Cache/UpdaterTest.php b/tests/lib/Files/Cache/UpdaterTest.php
index 6dd35149951..65c47cb9ae6 100644
--- a/tests/lib/Files/Cache/UpdaterTest.php
+++ b/tests/lib/Files/Cache/UpdaterTest.php
@@ -8,10 +8,13 @@
namespace Test\Files\Cache;
+use OC\Files\Cache\Cache;
use OC\Files\Filesystem;
use OC\Files\ObjectStore\ObjectStoreStorage;
use OC\Files\ObjectStore\StorageObjectStore;
+use OC\Files\Storage\Storage;
use OC\Files\Storage\Temporary;
+use OC\Files\View;
use OCP\Files\Storage\IStorage;
/**
@@ -23,17 +26,17 @@ use OCP\Files\Storage\IStorage;
*/
class UpdaterTest extends \Test\TestCase {
/**
- * @var \OC\Files\Storage\Storage
+ * @var Storage
*/
protected $storage;
/**
- * @var \OC\Files\Cache\Cache
+ * @var Cache
*/
protected $cache;
/**
- * @var \OC\Files\View
+ * @var View
*/
protected $view;
@@ -313,9 +316,7 @@ class UpdaterTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider changeExtensionProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('changeExtensionProvider')]
public function testChangeExtension(IStorage $storage) {
$updater = $storage->getUpdater();
$cache = $storage->getCache();
diff --git a/tests/lib/Files/Cache/WatcherTest.php b/tests/lib/Files/Cache/WatcherTest.php
index 3da6847d065..6d0a8e0886b 100644
--- a/tests/lib/Files/Cache/WatcherTest.php
+++ b/tests/lib/Files/Cache/WatcherTest.php
@@ -9,6 +9,7 @@
namespace Test\Files\Cache;
use OC\Files\Cache\Watcher;
+use OC\Files\Storage\Storage;
use OC\Files\Storage\Temporary;
/**
@@ -20,7 +21,7 @@ use OC\Files\Storage\Temporary;
*/
class WatcherTest extends \Test\TestCase {
/**
- * @var \OC\Files\Storage\Storage[] $storages
+ * @var Storage[] $storages
*/
private $storages = [];
@@ -176,7 +177,7 @@ class WatcherTest extends \Test\TestCase {
/**
* @param bool $scan
- * @return \OC\Files\Storage\Storage
+ * @return Storage
*/
private function getTestStorage($scan = true) {
$storage = new Temporary([]);
diff --git a/tests/lib/Files/Cache/Wrapper/CacheJailTest.php b/tests/lib/Files/Cache/Wrapper/CacheJailTest.php
index a470a52b62a..8ac3492fbd2 100644
--- a/tests/lib/Files/Cache/Wrapper/CacheJailTest.php
+++ b/tests/lib/Files/Cache/Wrapper/CacheJailTest.php
@@ -8,6 +8,7 @@
namespace Test\Files\Cache\Wrapper;
+use OC\Files\Cache\Cache;
use OC\Files\Cache\Wrapper\CacheJail;
use OC\Files\Cache\Wrapper\CacheWrapper;
use OC\Files\Search\SearchComparison;
@@ -28,7 +29,7 @@ use Test\Files\Cache\CacheTest;
*/
class CacheJailTest extends CacheTest {
/**
- * @var \OC\Files\Cache\Cache $sourceCache
+ * @var Cache $sourceCache
*/
protected $sourceCache;
diff --git a/tests/lib/Files/Cache/Wrapper/CachePermissionsMaskTest.php b/tests/lib/Files/Cache/Wrapper/CachePermissionsMaskTest.php
index 9180cb671fe..4fbeafc9270 100644
--- a/tests/lib/Files/Cache/Wrapper/CachePermissionsMaskTest.php
+++ b/tests/lib/Files/Cache/Wrapper/CachePermissionsMaskTest.php
@@ -8,6 +8,7 @@
namespace Test\Files\Cache\Wrapper;
+use OC\Files\Cache\Cache;
use OC\Files\Cache\Wrapper\CachePermissionsMask;
use OCP\Constants;
use Test\Files\Cache\CacheTest;
@@ -21,7 +22,7 @@ use Test\Files\Cache\CacheTest;
*/
class CachePermissionsMaskTest extends CacheTest {
/**
- * @var \OC\Files\Cache\Cache $sourceCache
+ * @var Cache $sourceCache
*/
protected $sourceCache;
@@ -46,9 +47,9 @@ class CachePermissionsMaskTest extends CacheTest {
}
/**
- * @dataProvider maskProvider
* @param int $mask
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('maskProvider')]
public function testGetMasked($mask): void {
$cache = $this->getMaskedCached($mask);
$data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain', 'permissions' => Constants::PERMISSION_ALL];
@@ -63,9 +64,9 @@ class CachePermissionsMaskTest extends CacheTest {
}
/**
- * @dataProvider maskProvider
* @param int $mask
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('maskProvider')]
public function testGetFolderContentMasked($mask): void {
$this->storage->mkdir('foo');
$this->storage->file_put_contents('foo/bar', 'asd');
@@ -82,9 +83,9 @@ class CachePermissionsMaskTest extends CacheTest {
}
/**
- * @dataProvider maskProvider
* @param int $mask
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('maskProvider')]
public function testSearchMasked($mask): void {
$this->storage->mkdir('foo');
$this->storage->file_put_contents('foo/bar', 'asd');
diff --git a/tests/lib/Files/FilenameValidatorTest.php b/tests/lib/Files/FilenameValidatorTest.php
index a4951c2efd3..162275a2cf8 100644
--- a/tests/lib/Files/FilenameValidatorTest.php
+++ b/tests/lib/Files/FilenameValidatorTest.php
@@ -48,9 +48,7 @@ class FilenameValidatorTest extends TestCase {
$this->database->method('supports4ByteText')->willReturn(true);
}
- /**
- * @dataProvider dataValidateFilename
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataValidateFilename')]
public function testValidateFilename(
string $filename,
array $forbiddenNames,
@@ -87,9 +85,7 @@ class FilenameValidatorTest extends TestCase {
$validator->validateFilename($filename);
}
- /**
- * @dataProvider dataValidateFilename
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataValidateFilename')]
public function testIsFilenameValid(
string $filename,
array $forbiddenNames,
@@ -189,9 +185,7 @@ class FilenameValidatorTest extends TestCase {
];
}
- /**
- * @dataProvider data4ByteUnicode
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('data4ByteUnicode')]
public function testDatabaseDoesNotSupport4ByteText($filename): void {
$database = $this->createMock(IDBConnection::class);
$database->expects($this->once())
@@ -209,9 +203,7 @@ class FilenameValidatorTest extends TestCase {
];
}
- /**
- * @dataProvider dataInvalidAsciiCharacters
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataInvalidAsciiCharacters')]
public function testInvalidAsciiCharactersAreAlwaysForbidden(string $filename): void {
$this->expectException(InvalidPathException::class);
$validator = new FilenameValidator($this->l10n, $this->database, $this->config, $this->logger);
@@ -255,9 +247,7 @@ class FilenameValidatorTest extends TestCase {
];
}
- /**
- * @dataProvider dataIsForbidden
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataIsForbidden')]
public function testIsForbidden(string $filename, array $forbiddenNames, bool $expected): void {
/** @var FilenameValidator&MockObject */
$validator = $this->getMockBuilder(FilenameValidator::class)
@@ -291,9 +281,7 @@ class FilenameValidatorTest extends TestCase {
];
}
- /**
- * @dataProvider dataGetForbiddenExtensions
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetForbiddenExtensions')]
public function testGetForbiddenExtensions(array $configValue, array $expectedValue): void {
$validator = new FilenameValidator($this->l10n, $this->database, $this->config, $this->logger);
$this->config
@@ -317,9 +305,7 @@ class FilenameValidatorTest extends TestCase {
];
}
- /**
- * @dataProvider dataGetForbiddenFilenames
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetForbiddenFilenames')]
public function testGetForbiddenFilenames(array $configValue, array $legacyValue, array $expectedValue): void {
$validator = new FilenameValidator($this->l10n, $this->database, $this->config, $this->logger);
$this->config
@@ -349,9 +335,7 @@ class FilenameValidatorTest extends TestCase {
];
}
- /**
- * @dataProvider dataGetForbiddenBasenames
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetForbiddenBasenames')]
public function testGetForbiddenBasenames(array $configValue, array $expectedValue): void {
$validator = new FilenameValidator($this->l10n, $this->database, $this->config, $this->logger);
$this->config
@@ -375,9 +359,7 @@ class FilenameValidatorTest extends TestCase {
];
}
- /**
- * @dataProvider dataSanitizeFilename
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSanitizeFilename')]
public function testSanitizeFilename(
string $filename,
array $forbiddenNames,
@@ -452,9 +434,7 @@ class FilenameValidatorTest extends TestCase {
];
}
- /**
- * @dataProvider dataSanitizeFilenameCharacterReplacement
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSanitizeFilenameCharacterReplacement')]
public function testSanitizeFilenameCharacterReplacement(
string $filename,
array $forbiddenCharacters,
diff --git a/tests/lib/Files/FilesystemTest.php b/tests/lib/Files/FilesystemTest.php
index 07166e098e7..a819acb1620 100644
--- a/tests/lib/Files/FilesystemTest.php
+++ b/tests/lib/Files/FilesystemTest.php
@@ -16,6 +16,7 @@ use OC\User\NoUserException;
use OCP\Files;
use OCP\Files\Config\IMountProvider;
use OCP\Files\Config\IMountProviderCollection;
+use OCP\Files\Mount\IMountPoint;
use OCP\Files\Storage\IStorageFactory;
use OCP\IConfig;
use OCP\ITempManager;
@@ -38,7 +39,7 @@ class DummyMountProvider implements IMountProvider {
*
* @param IUser $user
* @param IStorageFactory $loader
- * @return \OCP\Files\Mount\IMountPoint[]
+ * @return IMountPoint[]
*/
public function getMountsForUser(IUser $user, IStorageFactory $loader) {
return isset($this->mounts[$user->getUID()]) ? $this->mounts[$user->getUID()] : [];
@@ -201,9 +202,7 @@ class FilesystemTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider normalizePathData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('normalizePathData')]
public function testNormalizePath($expected, $path, $stripTrailingSlash = true): void {
$this->assertEquals($expected, Filesystem::normalizePath($path, $stripTrailingSlash));
}
@@ -219,9 +218,7 @@ class FilesystemTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider normalizePathKeepUnicodeData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('normalizePathKeepUnicodeData')]
public function testNormalizePathKeepUnicode($expected, $path, $keepUnicode = false): void {
$this->assertEquals($expected, Filesystem::normalizePath($path, true, false, $keepUnicode));
}
@@ -260,9 +257,7 @@ class FilesystemTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider isValidPathData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('isValidPathData')]
public function testIsValidPath($path, $expected): void {
$this->assertSame($expected, Filesystem::isValidPath($path));
}
@@ -282,9 +277,7 @@ class FilesystemTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider isFileBlacklistedData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('isFileBlacklistedData')]
public function testIsFileBlacklisted($path, $expected): void {
$this->assertSame($expected, Filesystem::isFileBlacklisted($path));
}
diff --git a/tests/lib/Files/Node/FolderTest.php b/tests/lib/Files/Node/FolderTest.php
index 76d6cdd56d7..439535cf2c1 100644
--- a/tests/lib/Files/Node/FolderTest.php
+++ b/tests/lib/Files/Node/FolderTest.php
@@ -25,8 +25,10 @@ use OC\Files\Search\SearchQuery;
use OC\Files\Storage\Storage;
use OC\Files\Storage\Temporary;
use OC\Files\Storage\Wrapper\Jail;
+use OC\Files\View;
use OCP\Constants;
use OCP\Files\Cache\ICacheEntry;
+use OCP\Files\InvalidPathException;
use OCP\Files\IRootFolder;
use OCP\Files\Mount\IMountPoint;
use OCP\Files\NotFoundException;
@@ -71,7 +73,7 @@ class FolderTest extends NodeTestCase {
public function testGetDirectoryContent(): void {
$manager = $this->createMock(Manager::class);
/**
- * @var \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject $view
+ * @var View|\PHPUnit\Framework\MockObject\MockObject $view
*/
$root = $this->getMockBuilder(Root::class)
->setConstructorArgs([$manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager, $this->eventDispatcher, $this->cacheFactory])
@@ -694,9 +696,7 @@ class FolderTest extends NodeTestCase {
];
}
- /**
- * @dataProvider uniqueNameProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('uniqueNameProvider')]
public function testGetUniqueName($name, $existingFiles, $expected): void {
$manager = $this->createMock(Manager::class);
$folderPath = '/bar/foo';
@@ -730,7 +730,7 @@ class FolderTest extends NodeTestCase {
->onlyMethods(['getUser', 'getMountsIn', 'getMount'])
->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager, $this->eventDispatcher, $this->cacheFactory])
->getMock();
- /** @var \PHPUnit\Framework\MockObject\MockObject|\OC\Files\FileInfo $folderInfo */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|FileInfo $folderInfo */
$folderInfo = $this->getMockBuilder(FileInfo::class)
->disableOriginalConstructor()->getMock();
@@ -799,7 +799,7 @@ class FolderTest extends NodeTestCase {
->onlyMethods(['getUser', 'getMountsIn', 'getMount'])
->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager, $this->eventDispatcher, $this->cacheFactory])
->getMock();
- /** @var \PHPUnit\Framework\MockObject\MockObject|\OC\Files\FileInfo $folderInfo */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|FileInfo $folderInfo */
$folderInfo = $this->getMockBuilder(FileInfo::class)
->disableOriginalConstructor()->getMock();
@@ -866,7 +866,7 @@ class FolderTest extends NodeTestCase {
->onlyMethods(['getUser', 'getMountsIn', 'getMount'])
->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager, $this->eventDispatcher, $this->cacheFactory])
->getMock();
- /** @var \PHPUnit\Framework\MockObject\MockObject|\OC\Files\FileInfo $folderInfo */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|FileInfo $folderInfo */
$folderInfo = $this->getMockBuilder(FileInfo::class)
->disableOriginalConstructor()->getMock();
@@ -935,14 +935,14 @@ class FolderTest extends NodeTestCase {
}
/**
- * @dataProvider offsetLimitProvider
* @param int $offset
* @param int $limit
* @param string[] $expectedPaths
* @param ISearchOrder[] $ordering
* @throws NotFoundException
- * @throws \OCP\Files\InvalidPathException
+ * @throws InvalidPathException
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('offsetLimitProvider')]
public function testSearchSubStoragesLimitOffset(int $offset, int $limit, array $expectedPaths, array $ordering): void {
if (!$ordering) {
$ordering = [new SearchOrder(ISearchOrder::DIRECTION_ASCENDING, 'fileid')];
diff --git a/tests/lib/Files/Node/HookConnectorTest.php b/tests/lib/Files/Node/HookConnectorTest.php
index eebba8bd28f..3f3957bab1d 100644
--- a/tests/lib/Files/Node/HookConnectorTest.php
+++ b/tests/lib/Files/Node/HookConnectorTest.php
@@ -153,8 +153,8 @@ class HookConnectorTest extends TestCase {
/**
* @param callable $operation
* @param string $expectedHook
- * @dataProvider viewToNodeProvider
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('viewToNodeProvider')]
public function testViewToNode(callable $operation, $expectedHook, $expectedLegacyEvent, $expectedEvent): void {
$connector = new HookConnector($this->root, $this->view, $this->eventDispatcher, $this->logger);
$connector->viewToNode();
@@ -222,8 +222,8 @@ class HookConnectorTest extends TestCase {
/**
* @param callable $operation
* @param string $expectedHook
- * @dataProvider viewToNodeProviderCopyRename
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('viewToNodeProviderCopyRename')]
public function testViewToNodeCopyRename(callable $operation, $expectedHook, $expectedLegacyEvent, $expectedEvent): void {
$connector = new HookConnector($this->root, $this->view, $this->eventDispatcher, $this->logger);
$connector->viewToNode();
diff --git a/tests/lib/Files/Node/IntegrationTest.php b/tests/lib/Files/Node/IntegrationTest.php
index 60f4ac5089c..f059afa1625 100644
--- a/tests/lib/Files/Node/IntegrationTest.php
+++ b/tests/lib/Files/Node/IntegrationTest.php
@@ -9,6 +9,7 @@
namespace Test\Files\Node;
use OC\Files\Node\Root;
+use OC\Files\Storage\Storage;
use OC\Files\Storage\Temporary;
use OC\Files\View;
use OC\Memcache\ArrayCache;
@@ -37,12 +38,12 @@ class IntegrationTest extends \Test\TestCase {
private $root;
/**
- * @var \OC\Files\Storage\Storage[]
+ * @var Storage[]
*/
private $storages;
/**
- * @var \OC\Files\View $view
+ * @var View $view
*/
private $view;
diff --git a/tests/lib/Files/Node/NodeTestCase.php b/tests/lib/Files/Node/NodeTestCase.php
index cfeeebf3efe..4aecd0fef11 100644
--- a/tests/lib/Files/Node/NodeTestCase.php
+++ b/tests/lib/Files/Node/NodeTestCase.php
@@ -13,10 +13,13 @@ use OC\Files\Mount\Manager;
use OC\Files\Node\File;
use OC\Files\Node\Folder;
use OC\Files\Node\Root;
+use OC\Files\Storage\Storage;
use OC\Files\View;
use OC\Memcache\ArrayCache;
+use OC\User\User;
use OCP\Constants;
use OCP\EventDispatcher\IEventDispatcher;
+use OCP\Files\Config\IUserMountCache;
use OCP\Files\InvalidPathException;
use OCP\Files\IRootFolder;
use OCP\Files\Mount\IMountPoint;
@@ -35,15 +38,15 @@ use Psr\Log\LoggerInterface;
* @package Test\Files\Node
*/
abstract class NodeTestCase extends \Test\TestCase {
- /** @var \OC\User\User */
+ /** @var User */
protected $user;
/** @var \OC\Files\Mount\Manager */
protected $manager;
- /** @var \OC\Files\View|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var View|\PHPUnit\Framework\MockObject\MockObject */
protected $view;
/** @var \OC\Files\Node\Root|\PHPUnit\Framework\MockObject\MockObject */
protected $root;
- /** @var \OCP\Files\Config\IUserMountCache|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var IUserMountCache|\PHPUnit\Framework\MockObject\MockObject */
protected $userMountCache;
/** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
protected $logger;
@@ -84,7 +87,7 @@ abstract class NodeTestCase extends \Test\TestCase {
}
/**
- * @return \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject $view
+ * @return View|\PHPUnit\Framework\MockObject\MockObject $view
*/
protected function getRootViewMock() {
$view = $this->createMock(View::class);
@@ -341,7 +344,7 @@ abstract class NodeTestCase extends \Test\TestCase {
->method('getUser')
->willReturn($this->user);
/**
- * @var \OC\Files\Storage\Storage | \PHPUnit\Framework\MockObject\MockObject $storage
+ * @var Storage|\PHPUnit\Framework\MockObject\MockObject $storage
*/
$storage = $this->getMockBuilder('\OC\Files\Storage\Storage')
->disableOriginalConstructor()
@@ -365,7 +368,7 @@ abstract class NodeTestCase extends \Test\TestCase {
->method('getUser')
->willReturn($this->user);
/**
- * @var \OC\Files\Storage\Storage | \PHPUnit\Framework\MockObject\MockObject $storage
+ * @var Storage|\PHPUnit\Framework\MockObject\MockObject $storage
*/
$storage = $this->getMockBuilder('\OC\Files\Storage\Storage')
->disableOriginalConstructor()
@@ -514,7 +517,7 @@ abstract class NodeTestCase extends \Test\TestCase {
$this->expectException(NotPermittedException::class);
/**
- * @var \OC\Files\Storage\Storage | \PHPUnit\Framework\MockObject\MockObject $storage
+ * @var Storage|\PHPUnit\Framework\MockObject\MockObject $storage
*/
$storage = $this->createMock('\OC\Files\Storage\Storage');
@@ -607,12 +610,12 @@ abstract class NodeTestCase extends \Test\TestCase {
}
/**
- * @dataProvider moveOrCopyProvider
* @param string $operationMethod
* @param string $viewMethod
* @param string $preHookName
* @param string $postHookName
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('moveOrCopyProvider')]
public function testMoveCopyHooks($operationMethod, $viewMethod, $preHookName, $postHookName): void {
/** @var IRootFolder|\PHPUnit\Framework\MockObject\MockObject $root */
$root = $this->getMockBuilder(Root::class)
@@ -707,7 +710,7 @@ abstract class NodeTestCase extends \Test\TestCase {
$this->expectException(NotFoundException::class);
/**
- * @var \OC\Files\Storage\Storage | \PHPUnit\Framework\MockObject\MockObject $storage
+ * @var Storage|\PHPUnit\Framework\MockObject\MockObject $storage
*/
$storage = $this->createMock('\OC\Files\Storage\Storage');
diff --git a/tests/lib/Files/Node/RootTest.php b/tests/lib/Files/Node/RootTest.php
index 4f1b4e86f8b..d90e6a2cc6e 100644
--- a/tests/lib/Files/Node/RootTest.php
+++ b/tests/lib/Files/Node/RootTest.php
@@ -12,11 +12,14 @@ use OC\Files\FileInfo;
use OC\Files\Mount\Manager;
use OC\Files\Node\Folder;
use OC\Files\Node\Root;
+use OC\Files\Storage\Storage;
use OC\Files\View;
use OC\Memcache\ArrayCache;
use OC\User\NoUserException;
+use OC\User\User;
use OCP\Cache\CappedMemoryCache;
use OCP\EventDispatcher\IEventDispatcher;
+use OCP\Files\Config\IUserMountCache;
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
use OCP\ICacheFactory;
@@ -30,11 +33,11 @@ use Psr\Log\LoggerInterface;
* @package Test\Files\Node
*/
class RootTest extends \Test\TestCase {
- /** @var \OC\User\User */
+ /** @var User */
private $user;
/** @var \OC\Files\Mount\Manager */
private $manager;
- /** @var \OCP\Files\Config\IUserMountCache|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var IUserMountCache|\PHPUnit\Framework\MockObject\MockObject */
private $userMountCache;
/** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
private $logger;
@@ -66,7 +69,7 @@ class RootTest extends \Test\TestCase {
}
/**
- * @return \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject $view
+ * @return View|\PHPUnit\Framework\MockObject\MockObject $view
*/
protected function getRootViewMock() {
$view = $this->createMock(View::class);
@@ -82,7 +85,7 @@ class RootTest extends \Test\TestCase {
public function testGet(): void {
/**
- * @var \OC\Files\Storage\Storage $storage
+ * @var Storage $storage
*/
$storage = $this->getMockBuilder('\OC\Files\Storage\Storage')
->disableOriginalConstructor()
@@ -115,7 +118,7 @@ class RootTest extends \Test\TestCase {
$this->expectException(NotFoundException::class);
/**
- * @var \OC\Files\Storage\Storage $storage
+ * @var Storage $storage
*/
$storage = $this->getMockBuilder('\OC\Files\Storage\Storage')
->disableOriginalConstructor()
diff --git a/tests/lib/Files/ObjectStore/FailDeleteObjectStore.php b/tests/lib/Files/ObjectStore/FailDeleteObjectStore.php
index b84ee1a1b64..767125d42aa 100644
--- a/tests/lib/Files/ObjectStore/FailDeleteObjectStore.php
+++ b/tests/lib/Files/ObjectStore/FailDeleteObjectStore.php
@@ -11,10 +11,9 @@ namespace Test\Files\ObjectStore;
use OCP\Files\ObjectStore\IObjectStore;
class FailDeleteObjectStore implements IObjectStore {
- private $objectStore;
-
- public function __construct(IObjectStore $objectStore) {
- $this->objectStore = $objectStore;
+ public function __construct(
+ private IObjectStore $objectStore,
+ ) {
}
public function getStorageId() {
diff --git a/tests/lib/Files/ObjectStore/FailWriteObjectStore.php b/tests/lib/Files/ObjectStore/FailWriteObjectStore.php
index b84b123244e..924bbdada4f 100644
--- a/tests/lib/Files/ObjectStore/FailWriteObjectStore.php
+++ b/tests/lib/Files/ObjectStore/FailWriteObjectStore.php
@@ -11,10 +11,9 @@ namespace Test\Files\ObjectStore;
use OCP\Files\ObjectStore\IObjectStore;
class FailWriteObjectStore implements IObjectStore {
- private $objectStore;
-
- public function __construct(IObjectStore $objectStore) {
- $this->objectStore = $objectStore;
+ public function __construct(
+ private IObjectStore $objectStore,
+ ) {
}
public function getStorageId() {
diff --git a/tests/lib/Files/ObjectStore/LocalTest.php b/tests/lib/Files/ObjectStore/LocalTest.php
index 6b779edb200..d3e9ad56164 100644
--- a/tests/lib/Files/ObjectStore/LocalTest.php
+++ b/tests/lib/Files/ObjectStore/LocalTest.php
@@ -9,10 +9,11 @@ namespace Test\Files\ObjectStore;
use OC\Files\ObjectStore\StorageObjectStore;
use OC\Files\Storage\Temporary;
+use OCP\Files\ObjectStore\IObjectStore;
class LocalTest extends ObjectStoreTestCase {
/**
- * @return \OCP\Files\ObjectStore\IObjectStore
+ * @return IObjectStore
*/
protected function getInstance() {
$storage = new Temporary();
diff --git a/tests/lib/Files/ObjectStore/MapperTest.php b/tests/lib/Files/ObjectStore/MapperTest.php
index 42ca90bf0e6..6448d5ce1f5 100644
--- a/tests/lib/Files/ObjectStore/MapperTest.php
+++ b/tests/lib/Files/ObjectStore/MapperTest.php
@@ -43,11 +43,11 @@ class MapperTest extends \Test\TestCase {
}
/**
- * @dataProvider dataGetBucket
* @param string $username
* @param int $numBuckets
* @param string $expectedBucket
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetBucket')]
public function testGetBucket($username, $numBuckets, $bucketShift, $expectedBucket): void {
$this->user->expects($this->once())
->method('getUID')
diff --git a/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php b/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php
index 5b36e98119d..3387808445a 100644
--- a/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php
+++ b/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php
@@ -73,9 +73,7 @@ class ObjectStoreStorageTest extends Storage {
$this->markTestSkipped('Detecting external changes is not supported on object storages');
}
- /**
- * @dataProvider copyAndMoveProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('copyAndMoveProvider')]
public function testMove($source, $target): void {
$this->initSourceAndTarget($source);
$sourceId = $this->instance->getCache()->getId(ltrim($source, '/'));
diff --git a/tests/lib/Files/ObjectStore/ObjectStoreStoragesDifferentBucketTest.php b/tests/lib/Files/ObjectStore/ObjectStoreStoragesDifferentBucketTest.php
index f6125979ccb..d39426ee821 100644
--- a/tests/lib/Files/ObjectStore/ObjectStoreStoragesDifferentBucketTest.php
+++ b/tests/lib/Files/ObjectStore/ObjectStoreStoragesDifferentBucketTest.php
@@ -10,6 +10,7 @@ namespace Test\Files\ObjectStore;
use OC\Files\ObjectStore\StorageObjectStore;
use OC\Files\Storage\Temporary;
+use OCP\Files\ObjectStore\IObjectStore;
use Test\Files\Storage\StoragesTestCase;
/**
@@ -17,12 +18,12 @@ use Test\Files\Storage\StoragesTestCase;
*/
class ObjectStoreStoragesDifferentBucketTest extends StoragesTestCase {
/**
- * @var \OCP\Files\ObjectStore\IObjectStore
+ * @var IObjectStore
*/
private $objectStore1;
/**
- * @var \OCP\Files\ObjectStore\IObjectStore
+ * @var IObjectStore
*/
private $objectStore2;
diff --git a/tests/lib/Files/ObjectStore/ObjectStoreStoragesSameBucketTest.php b/tests/lib/Files/ObjectStore/ObjectStoreStoragesSameBucketTest.php
index cfb351e636a..4e42668cd3f 100644
--- a/tests/lib/Files/ObjectStore/ObjectStoreStoragesSameBucketTest.php
+++ b/tests/lib/Files/ObjectStore/ObjectStoreStoragesSameBucketTest.php
@@ -10,6 +10,7 @@ namespace Test\Files\ObjectStore;
use OC\Files\ObjectStore\StorageObjectStore;
use OC\Files\Storage\Temporary;
+use OCP\Files\ObjectStore\IObjectStore;
use Test\Files\Storage\StoragesTestCase;
/**
@@ -17,7 +18,7 @@ use Test\Files\Storage\StoragesTestCase;
*/
class ObjectStoreStoragesSameBucketTest extends StoragesTestCase {
/**
- * @var \OCP\Files\ObjectStore\IObjectStore
+ * @var IObjectStore
*/
private $objectStore;
diff --git a/tests/lib/Files/ObjectStore/ObjectStoreTestCase.php b/tests/lib/Files/ObjectStore/ObjectStoreTestCase.php
index ecbfd9a37e6..03e7b9545e0 100644
--- a/tests/lib/Files/ObjectStore/ObjectStoreTestCase.php
+++ b/tests/lib/Files/ObjectStore/ObjectStoreTestCase.php
@@ -7,6 +7,7 @@
namespace Test\Files\ObjectStore;
+use OCP\Files\ObjectStore\IObjectStore;
use Test\TestCase;
abstract class ObjectStoreTestCase extends TestCase {
@@ -16,7 +17,7 @@ abstract class ObjectStoreTestCase extends TestCase {
private $instance = null;
/**
- * @return \OCP\Files\ObjectStore\IObjectStore
+ * @return IObjectStore
*/
abstract protected function getInstance();
diff --git a/tests/lib/Files/ObjectStore/S3Test.php b/tests/lib/Files/ObjectStore/S3Test.php
index 8547a18ad13..2915ada0aab 100644
--- a/tests/lib/Files/ObjectStore/S3Test.php
+++ b/tests/lib/Files/ObjectStore/S3Test.php
@@ -135,7 +135,7 @@ class S3Test extends ObjectStoreTestCase {
];
}
- /** @dataProvider dataFileSizes */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataFileSizes')]
public function testFileSizes($size): void {
if (str_starts_with(PHP_VERSION, '8.3') && getenv('CI')) {
$this->markTestSkipped('Test is unreliable and skipped on 8.3');
diff --git a/tests/lib/Files/ObjectStore/SwiftTest.php b/tests/lib/Files/ObjectStore/SwiftTest.php
index 958aee2f785..3f919c0dd48 100644
--- a/tests/lib/Files/ObjectStore/SwiftTest.php
+++ b/tests/lib/Files/ObjectStore/SwiftTest.php
@@ -9,6 +9,7 @@
namespace Test\Files\ObjectStore;
use OC\Files\ObjectStore\Swift;
+use OCP\Files\ObjectStore\IObjectStore;
use OCP\IConfig;
use OCP\Server;
@@ -17,7 +18,7 @@ use OCP\Server;
*/
class SwiftTest extends ObjectStoreTestCase {
/**
- * @return \OCP\Files\ObjectStore\IObjectStore
+ * @return IObjectStore
*/
protected function getInstance() {
$config = Server::get(IConfig::class)->getSystemValue('objectstore');
diff --git a/tests/lib/Files/PathVerificationTest.php b/tests/lib/Files/PathVerificationTest.php
index 75f8302d89c..e13dbe4f207 100644
--- a/tests/lib/Files/PathVerificationTest.php
+++ b/tests/lib/Files/PathVerificationTest.php
@@ -23,7 +23,7 @@ use OCP\Server;
*/
class PathVerificationTest extends \Test\TestCase {
/**
- * @var \OC\Files\View
+ * @var View
*/
private $view;
@@ -42,9 +42,7 @@ class PathVerificationTest extends \Test\TestCase {
}
- /**
- * @dataProvider providesEmptyFiles
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providesEmptyFiles')]
public function testPathVerificationEmptyFileName($fileName): void {
$this->expectException(InvalidPathException::class);
$this->expectExceptionMessage('Empty filename is not allowed');
@@ -59,9 +57,7 @@ class PathVerificationTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider providesDotFiles
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providesDotFiles')]
public function testPathVerificationDotFiles($fileName): void {
$this->expectException(InvalidPathException::class);
$this->expectExceptionMessage('Dot files are not allowed');
@@ -82,9 +78,7 @@ class PathVerificationTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider providesAstralPlane
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providesAstralPlane')]
public function testPathVerificationAstralPlane($fileName): void {
$connection = Server::get(IDBConnection::class);
@@ -109,9 +103,7 @@ class PathVerificationTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider providesValidPosixPaths
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providesValidPosixPaths')]
public function testPathVerificationValidPaths($fileName): void {
$storage = new Local(['datadir' => '']);
diff --git a/tests/lib/Files/Storage/HomeTest.php b/tests/lib/Files/Storage/HomeTest.php
index 714278316d0..84a9816cb0c 100644
--- a/tests/lib/Files/Storage/HomeTest.php
+++ b/tests/lib/Files/Storage/HomeTest.php
@@ -50,7 +50,7 @@ class HomeTest extends Storage {
private $userId;
/**
- * @var \OC\User\User $user
+ * @var User $user
*/
private $user;
diff --git a/tests/lib/Files/Storage/Storage.php b/tests/lib/Files/Storage/Storage.php
index 96af5e9fb23..51bb5b7c8ad 100644
--- a/tests/lib/Files/Storage/Storage.php
+++ b/tests/lib/Files/Storage/Storage.php
@@ -51,9 +51,7 @@ abstract class Storage extends \Test\TestCase {
$this->assertTrue($this->instance->test());
}
- /**
- * @dataProvider directoryProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('directoryProvider')]
public function testDirectories($directory): void {
$this->assertFalse($this->instance->file_exists('/' . $directory));
@@ -144,9 +142,8 @@ abstract class Storage extends \Test\TestCase {
/**
* test the various uses of file_get_contents and file_put_contents
- *
- * @dataProvider loremFileProvider
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('loremFileProvider')]
public function testGetPutContents($sourceFile): void {
$sourceText = file_get_contents($sourceFile);
@@ -212,9 +209,7 @@ abstract class Storage extends \Test\TestCase {
);
}
- /**
- * @dataProvider copyAndMoveProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('copyAndMoveProvider')]
public function testCopy($source, $target): void {
$this->initSourceAndTarget($source);
@@ -225,9 +220,7 @@ abstract class Storage extends \Test\TestCase {
$this->assertTrue($this->instance->file_exists($source), $source . ' was deleted');
}
- /**
- * @dataProvider copyAndMoveProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('copyAndMoveProvider')]
public function testMove($source, $target): void {
$this->initSourceAndTarget($source);
@@ -239,9 +232,7 @@ abstract class Storage extends \Test\TestCase {
$this->assertSameAsLorem($target);
}
- /**
- * @dataProvider copyAndMoveProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('copyAndMoveProvider')]
public function testCopyOverwrite($source, $target): void {
$this->initSourceAndTarget($source, $target);
@@ -253,9 +244,7 @@ abstract class Storage extends \Test\TestCase {
$this->assertSameAsLorem($source);
}
- /**
- * @dataProvider copyAndMoveProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('copyAndMoveProvider')]
public function testMoveOverwrite($source, $target): void {
$this->initSourceAndTarget($source, $target);
@@ -352,9 +341,7 @@ abstract class Storage extends \Test\TestCase {
$this->assertFalse($this->instance->file_exists('/lorem.txt'));
}
- /**
- * @dataProvider fileNameProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('fileNameProvider')]
public function testFOpen($fileName): void {
$textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt';
@@ -424,9 +411,7 @@ abstract class Storage extends \Test\TestCase {
];
}
- /**
- * @dataProvider hashProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('hashProvider')]
public function testHash($data, $type): void {
$this->instance->file_put_contents('hash.txt', $data);
$this->assertEquals(hash($type, $data), $this->instance->hash($type, 'hash.txt'));
@@ -580,9 +565,7 @@ abstract class Storage extends \Test\TestCase {
$this->assertFalse($this->instance->instanceOfStorage('\OC'));
}
- /**
- * @dataProvider copyAndMoveProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('copyAndMoveProvider')]
public function testCopyFromSameStorage($source, $target): void {
$this->initSourceAndTarget($source);
diff --git a/tests/lib/Files/Storage/StoragesTestCase.php b/tests/lib/Files/Storage/StoragesTestCase.php
index a4b0beac199..565ff1ddfda 100644
--- a/tests/lib/Files/Storage/StoragesTestCase.php
+++ b/tests/lib/Files/Storage/StoragesTestCase.php
@@ -8,16 +8,17 @@
namespace Test\Files\Storage;
+use OC\Files\Storage\Storage;
use Test\TestCase;
abstract class StoragesTestCase extends TestCase {
/**
- * @var \OC\Files\Storage\Storage
+ * @var Storage
*/
protected $storage1;
/**
- * @var \OC\Files\Storage\Storage
+ * @var Storage
*/
protected $storage2;
diff --git a/tests/lib/Files/Storage/Wrapper/EncodingTest.php b/tests/lib/Files/Storage/Wrapper/EncodingTest.php
index de44ad78c7d..cb6b6de0fb7 100644
--- a/tests/lib/Files/Storage/Wrapper/EncodingTest.php
+++ b/tests/lib/Files/Storage/Wrapper/EncodingTest.php
@@ -16,7 +16,7 @@ class EncodingTest extends \Test\Files\Storage\Storage {
public const NFC_NAME = 'รผmlaut';
/**
- * @var \OC\Files\Storage\Temporary
+ * @var Temporary
*/
private $sourceStorage;
@@ -58,17 +58,13 @@ class EncodingTest extends \Test\Files\Storage\Storage {
];
}
- /**
- * @dataProvider accessNameProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('accessNameProvider')]
public function testFputEncoding($accessName): void {
$this->sourceStorage->file_put_contents(self::NFD_NAME, 'bar');
$this->assertEquals('bar', $this->instance->file_get_contents($accessName));
}
- /**
- * @dataProvider accessNameProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('accessNameProvider')]
public function testFopenReadEncoding($accessName): void {
$this->sourceStorage->file_put_contents(self::NFD_NAME, 'bar');
$fh = $this->instance->fopen($accessName, 'r');
@@ -77,9 +73,7 @@ class EncodingTest extends \Test\Files\Storage\Storage {
$this->assertEquals('bar', $data);
}
- /**
- * @dataProvider accessNameProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('accessNameProvider')]
public function testFopenOverwriteEncoding($accessName): void {
$this->sourceStorage->file_put_contents(self::NFD_NAME, 'bar');
$fh = $this->instance->fopen($accessName, 'w');
@@ -90,17 +84,13 @@ class EncodingTest extends \Test\Files\Storage\Storage {
$this->assertFalse($this->sourceStorage->file_exists(self::NFC_NAME));
}
- /**
- * @dataProvider accessNameProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('accessNameProvider')]
public function testFileExistsEncoding($accessName): void {
$this->sourceStorage->file_put_contents(self::NFD_NAME, 'bar');
$this->assertTrue($this->instance->file_exists($accessName));
}
- /**
- * @dataProvider accessNameProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('accessNameProvider')]
public function testUnlinkEncoding($accessName): void {
$this->sourceStorage->file_put_contents(self::NFD_NAME, 'bar');
$this->assertTrue($this->instance->unlink($accessName));
@@ -122,9 +112,7 @@ class EncodingTest extends \Test\Files\Storage\Storage {
];
}
- /**
- * @dataProvider encodedDirectoriesProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('encodedDirectoriesProvider')]
public function testOperationInsideDirectory($sourceDir, $accessDir): void {
$this->sourceStorage->mkdir($sourceDir);
$this->instance->file_put_contents($accessDir . '/test.txt', 'bar');
@@ -163,9 +151,7 @@ class EncodingTest extends \Test\Files\Storage\Storage {
];
}
- /**
- * @dataProvider sourceAndTargetDirectoryProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('sourceAndTargetDirectoryProvider')]
public function testCopyAndMoveEncodedFolder($sourceDir, $targetDir): void {
$this->sourceStorage->mkdir($sourceDir);
$this->sourceStorage->mkdir($targetDir);
@@ -183,9 +169,7 @@ class EncodingTest extends \Test\Files\Storage\Storage {
$this->assertEquals('bar', $this->instance->file_get_contents(self::NFC_NAME . '2/test2.txt'));
}
- /**
- * @dataProvider sourceAndTargetDirectoryProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('sourceAndTargetDirectoryProvider')]
public function testCopyAndMoveFromStorageEncodedFolder($sourceDir, $targetDir): void {
$this->sourceStorage->mkdir($sourceDir);
$this->sourceStorage->mkdir($targetDir);
diff --git a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php
index 37527c63a12..3e643714300 100644
--- a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php
+++ b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php
@@ -194,7 +194,6 @@ class EncryptionTest extends Storage {
}
/**
- * @dataProvider dataTestGetMetaData
*
* @param string $path
* @param array $metaData
@@ -203,6 +202,7 @@ class EncryptionTest extends Storage {
* @param int $storedUnencryptedSize
* @param array $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetMetaData')]
public function testGetMetaData($path, $metaData, $encrypted, $unencryptedSizeSet, $storedUnencryptedSize, $expected): void {
$sourceStorage = $this->getMockBuilder('\OC\Files\Storage\Storage')
->disableOriginalConstructor()->getMock();
@@ -328,13 +328,13 @@ class EncryptionTest extends Storage {
}
/**
- * @dataProvider dataTestVerifyUnencryptedSize
*
* @param int $encryptedSize
* @param int $unencryptedSize
* @param bool $failure
* @param int $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestVerifyUnencryptedSize')]
public function testVerifyUnencryptedSize($encryptedSize, $unencryptedSize, $failure, $expected): void {
$sourceStorage = $this->getMockBuilder('\OC\Files\Storage\Storage')
->disableOriginalConstructor()->getMock();
@@ -391,13 +391,13 @@ class EncryptionTest extends Storage {
}
/**
- * @dataProvider dataTestCopyAndRename
*
* @param string $source
* @param string $target
* @param $encryptionEnabled
* @param boolean $renameKeysReturn
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestCopyAndRename')]
public function testRename($source,
$target,
$encryptionEnabled,
@@ -453,13 +453,13 @@ class EncryptionTest extends Storage {
}
/**
- * @dataProvider dataTestRmdir
*
* @param string $path
* @param boolean $rmdirResult
* @param boolean $isExcluded
* @param boolean $encryptionEnabled
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestRmdir')]
public function testRmdir($path, $rmdirResult, $isExcluded, $encryptionEnabled): void {
$sourceStorage = $this->getMockBuilder('\OC\Files\Storage\Storage')
->disableOriginalConstructor()->getMock();
@@ -511,11 +511,11 @@ class EncryptionTest extends Storage {
}
/**
- * @dataProvider dataTestCopyKeys
*
* @param boolean $excluded
* @param boolean $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestCopyKeys')]
public function testCopyKeys($excluded, $expected): void {
$this->util->expects($this->once())
->method('isExcluded')
@@ -540,12 +540,12 @@ class EncryptionTest extends Storage {
}
/**
- * @dataProvider dataTestGetHeader
*
* @param string $path
* @param bool $strippedPathExists
* @param string $strippedPath
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetHeader')]
public function testGetHeader($path, $strippedPathExists, $strippedPath): void {
$sourceStorage = $this->getMockBuilder('\OC\Files\Storage\Storage')
->disableOriginalConstructor()->getMock();
@@ -632,9 +632,8 @@ class EncryptionTest extends Storage {
/**
* test if getHeader adds the default module correctly to the header for
* legacy files
- *
- * @dataProvider dataTestGetHeaderAddLegacyModule
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetHeaderAddLegacyModule')]
public function testGetHeaderAddLegacyModule($header, $isEncrypted, $strippedPathExists, $expected): void {
$sourceStorage = $this->getMockBuilder(\OC\Files\Storage\Storage::class)
->disableOriginalConstructor()->getMock();
@@ -762,12 +761,12 @@ class EncryptionTest extends Storage {
}
/**
- * @dataProvider dataCopyBetweenStorage
*
* @param bool $encryptionEnabled
* @param bool $mountPointEncryptionEnabled
* @param bool $expectedEncrypted
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataCopyBetweenStorage')]
public function testCopyBetweenStorage($encryptionEnabled, $mountPointEncryptionEnabled, $expectedEncrypted): void {
$storage2 = $this->createMock(\OC\Files\Storage\Storage::class);
@@ -822,13 +821,13 @@ class EncryptionTest extends Storage {
}
/**
- * @dataProvider dataTestCopyBetweenStorageVersions
*
* @param string $sourceInternalPath
* @param string $targetInternalPath
* @param bool $copyResult
* @param bool $encrypted
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestCopyBetweenStorageVersions')]
public function testCopyBetweenStorageVersions($sourceInternalPath, $targetInternalPath, $copyResult, $encrypted): void {
$sourceStorage = $this->createMock(\OC\Files\Storage\Storage::class);
@@ -916,10 +915,10 @@ class EncryptionTest extends Storage {
}
/**
- * @dataProvider dataTestIsVersion
* @param string $path
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestIsVersion')]
public function testIsVersion($path, $expected): void {
$this->assertSame($expected,
$this->invokePrivate($this->instance, 'isVersion', [$path])
@@ -938,13 +937,13 @@ class EncryptionTest extends Storage {
}
/**
- * @dataProvider dataTestShouldEncrypt
*
* @param bool $encryptMountPoint
* @param mixed $encryptionModule
* @param bool $encryptionModuleShouldEncrypt
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestShouldEncrypt')]
public function testShouldEncrypt(
$encryptMountPoint,
$encryptionModule,
diff --git a/tests/lib/Files/Storage/Wrapper/JailTest.php b/tests/lib/Files/Storage/Wrapper/JailTest.php
index 9ce3e1667f6..0043e37ba33 100644
--- a/tests/lib/Files/Storage/Wrapper/JailTest.php
+++ b/tests/lib/Files/Storage/Wrapper/JailTest.php
@@ -14,7 +14,7 @@ use OC\Files\Storage\Wrapper\Jail;
class JailTest extends \Test\Files\Storage\Storage {
/**
- * @var \OC\Files\Storage\Temporary
+ * @var Temporary
*/
private $sourceStorage;
diff --git a/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php b/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php
index 6ae03186faf..a2f3460c58c 100644
--- a/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php
+++ b/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php
@@ -19,7 +19,7 @@ use OCP\Files\Cache\IScanner;
*/
class PermissionsMaskTest extends \Test\Files\Storage\Storage {
/**
- * @var \OC\Files\Storage\Temporary
+ * @var Temporary
*/
private $sourceStorage;
diff --git a/tests/lib/Files/Stream/EncryptionTest.php b/tests/lib/Files/Stream/EncryptionTest.php
index c676358ad71..62eaab3cc7e 100644
--- a/tests/lib/Files/Stream/EncryptionTest.php
+++ b/tests/lib/Files/Stream/EncryptionTest.php
@@ -101,9 +101,7 @@ class EncryptionTest extends \Test\TestCase {
);
}
- /**
- * @dataProvider dataProviderStreamOpen()
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataProviderStreamOpen')]
public function testStreamOpen(
$isMasterKeyUsed,
$mode,
@@ -277,9 +275,7 @@ class EncryptionTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider dataFilesProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataFilesProvider')]
public function testWriteReadBigFile($testFile): void {
$expectedData = file_get_contents(\OC::$SERVERROOT . '/tests/data/' . $testFile);
// write it
@@ -314,9 +310,8 @@ class EncryptionTest extends \Test\TestCase {
/**
* simulate a non-seekable storage
- *
- * @dataProvider dataFilesProvider
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataFilesProvider')]
public function testWriteToNonSeekableStorage($testFile): void {
$wrapper = $this->getMockBuilder(Encryption::class)
->onlyMethods(['parentStreamSeek'])
diff --git a/tests/lib/Files/Stream/HashWrapperTest.php b/tests/lib/Files/Stream/HashWrapperTest.php
index 66dee77b607..459bc5c4318 100644
--- a/tests/lib/Files/Stream/HashWrapperTest.php
+++ b/tests/lib/Files/Stream/HashWrapperTest.php
@@ -12,9 +12,7 @@ use OC\Files\Stream\HashWrapper;
use Test\TestCase;
class HashWrapperTest extends TestCase {
- /**
- * @dataProvider hashProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('hashProvider')]
public function testHashStream($data, string $algo, string $hash): void {
if (!is_resource($data)) {
$tmpData = fopen('php://temp', 'r+');
diff --git a/tests/lib/Files/Type/DetectionTest.php b/tests/lib/Files/Type/DetectionTest.php
index 7f15f8c1108..c30b21de401 100644
--- a/tests/lib/Files/Type/DetectionTest.php
+++ b/tests/lib/Files/Type/DetectionTest.php
@@ -47,11 +47,11 @@ class DetectionTest extends \Test\TestCase {
}
/**
- * @dataProvider dataDetectPath
*
* @param string $path
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataDetectPath')]
public function testDetectPath(string $path, string $expected): void {
$this->assertEquals($expected, $this->detection->detectPath($path));
}
@@ -67,11 +67,11 @@ class DetectionTest extends \Test\TestCase {
}
/**
- * @dataProvider dataDetectContent
*
* @param string $path
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataDetectContent')]
public function testDetectContent(string $path, string $expected): void {
$this->assertEquals($expected, $this->detection->detectContent(\OC::$SERVERROOT . '/tests/data' . $path));
}
@@ -87,11 +87,11 @@ class DetectionTest extends \Test\TestCase {
}
/**
- * @dataProvider dataDetect
*
* @param string $path
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataDetect')]
public function testDetect(string $path, string $expected): void {
$this->assertEquals($expected, $this->detection->detect(\OC::$SERVERROOT . '/tests/data' . $path));
}
@@ -111,11 +111,11 @@ class DetectionTest extends \Test\TestCase {
}
/**
- * @dataProvider dataMimeTypeCustom
*
* @param string $ext
* @param string $mime
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataMimeTypeCustom')]
public function testDetectMimeTypeCustom(string $ext, string $mime): void {
$confDir = sys_get_temp_dir();
file_put_contents($confDir . '/mimetypemapping.dist.json', json_encode([]));
@@ -145,11 +145,11 @@ class DetectionTest extends \Test\TestCase {
}
/**
- * @dataProvider dataGetSecureMimeType
*
* @param string $mimeType
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetSecureMimeType')]
public function testGetSecureMimeType(string $mimeType, string $expected): void {
$this->assertEquals($expected, $this->detection->getSecureMimeType($mimeType));
}
diff --git a/tests/lib/Files/Utils/ScannerTest.php b/tests/lib/Files/Utils/ScannerTest.php
index 94c4e0f6e9d..49399ef70a6 100644
--- a/tests/lib/Files/Utils/ScannerTest.php
+++ b/tests/lib/Files/Utils/ScannerTest.php
@@ -24,12 +24,12 @@ use Psr\Log\LoggerInterface;
class TestScanner extends Scanner {
/**
- * @var \OC\Files\Mount\MountPoint[] $mounts
+ * @var MountPoint[] $mounts
*/
private $mounts = [];
/**
- * @param \OC\Files\Mount\MountPoint $mount
+ * @param MountPoint $mount
*/
public function addMount($mount) {
$this->mounts[] = $mount;
@@ -159,9 +159,9 @@ class ScannerTest extends \Test\TestCase {
}
/**
- * @dataProvider invalidPathProvider
* @param string $invalidPath
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('invalidPathProvider')]
public function testInvalidPathScanning($invalidPath): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Invalid path to scan');
diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php
index 80caed0d15b..c490cd08dae 100644
--- a/tests/lib/Files/ViewTest.php
+++ b/tests/lib/Files/ViewTest.php
@@ -33,8 +33,10 @@ use OCP\Files\Storage\IStorage;
use OCP\Files\Storage\IStorageFactory;
use OCP\IConfig;
use OCP\IDBConnection;
+use OCP\IGroup;
use OCP\IGroupManager;
use OCP\ITempManager;
+use OCP\IUser;
use OCP\IUserManager;
use OCP\Lock\ILockingProvider;
use OCP\Lock\LockedException;
@@ -95,7 +97,7 @@ class ViewTest extends \Test\TestCase {
use UserTrait;
/**
- * @var \OC\Files\Storage\Storage[] $storages
+ * @var Storage[] $storages
*/
private $storages = [];
@@ -105,16 +107,16 @@ class ViewTest extends \Test\TestCase {
private $user;
/**
- * @var \OCP\IUser
+ * @var IUser
*/
private $userObject;
/**
- * @var \OCP\IGroup
+ * @var IGroup
*/
private $groupObject;
- /** @var \OC\Files\Storage\Storage */
+ /** @var Storage */
private $tempStorage;
protected function setUp(): void {
@@ -318,9 +320,7 @@ class ViewTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider sharingDisabledPermissionProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('sharingDisabledPermissionProvider')]
public function testRemoveSharePermissionWhenSharingDisabledForUser($excludeGroups, $excludeGroupsList, $expectedShareable): void {
// Reset sharing disabled for users cache
self::invokePrivate(Server::get(ShareDisableChecker::class), 'sharingDisabledForUsersCache', [new CappedMemoryCache()]);
@@ -567,9 +567,7 @@ class ViewTest extends \Test\TestCase {
return [['rmdir'], ['unlink']];
}
- /**
- * @dataProvider rmdirOrUnlinkDataProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('rmdirOrUnlinkDataProvider')]
public function testRmdir($method): void {
$storage1 = $this->getTestStorage();
Filesystem::mount($storage1, [], '/');
@@ -690,11 +688,11 @@ class ViewTest extends \Test\TestCase {
/**
* @param bool $scan
* @param string $class
- * @return \OC\Files\Storage\Storage
+ * @return Storage
*/
private function getTestStorage($scan = true, $class = Temporary::class) {
/**
- * @var \OC\Files\Storage\Storage $storage
+ * @var Storage $storage
*/
$storage = new $class([]);
$textData = "dummy file data\n";
@@ -776,9 +774,7 @@ class ViewTest extends \Test\TestCase {
\OC_Hook::clear('OC_Filesystem', 'post_write');
}
- /**
- * @dataProvider resolvePathTestProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('resolvePathTestProvider')]
public function testResolvePath($expected, $pathToTest): void {
$storage1 = $this->getTestStorage();
Filesystem::mount($storage1, [], '/');
@@ -938,9 +934,7 @@ class ViewTest extends \Test\TestCase {
$this->assertNotEquals($newFolderInfo->getEtag(), $oldEtag);
}
- /**
- * @dataProvider absolutePathProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('absolutePathProvider')]
public function testGetAbsolutePath($expectedPath, $relativePath): void {
$view = new View('/files');
$this->assertEquals($expectedPath, $view->getAbsolutePath($relativePath));
@@ -974,9 +968,7 @@ class ViewTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider chrootRelativePathProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('chrootRelativePathProvider')]
public function testChrootGetRelativePath($root, $absolutePath, $expectedPath): void {
$view = new View('/files');
$view->chroot($root);
@@ -987,9 +979,7 @@ class ViewTest extends \Test\TestCase {
return self::relativePathProvider('/');
}
- /**
- * @dataProvider initRelativePathProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('initRelativePathProvider')]
public function testInitGetRelativePath($root, $absolutePath, $expectedPath): void {
$view = new View($root);
$this->assertEquals($expectedPath, $view->getRelativePath($absolutePath));
@@ -1086,9 +1076,7 @@ class ViewTest extends \Test\TestCase {
$this->assertEquals('foo', $view->file_get_contents(''));
}
- /**
- * @dataProvider tooLongPathDataProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('tooLongPathDataProvider')]
public function testTooLongPath($operation, $param0 = null): void {
$this->expectException(InvalidPathException::class);
@@ -1274,9 +1262,9 @@ class ViewTest extends \Test\TestCase {
}
/**
- * @dataProvider directoryTraversalProvider
* @param string $root
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('directoryTraversalProvider')]
public function testConstructDirectoryTraversalException($root): void {
$this->expectException(\Exception::class);
@@ -1299,7 +1287,7 @@ class ViewTest extends \Test\TestCase {
public function testSetMountOptionsInStorage(): void {
$mount = new MountPoint(Temporary::class, '/asd/', [[]], Filesystem::getLoader(), ['foo' => 'bar']);
Filesystem::getMountManager()->addMount($mount);
- /** @var \OC\Files\Storage\Common $storage */
+ /** @var Common $storage */
$storage = $mount->getStorage();
$this->assertEquals($storage->getMountOption('foo'), 'bar');
}
@@ -1307,7 +1295,7 @@ class ViewTest extends \Test\TestCase {
public function testSetMountOptionsWatcherPolicy(): void {
$mount = new MountPoint(Temporary::class, '/asd/', [[]], Filesystem::getLoader(), ['filesystem_check_changes' => Watcher::CHECK_NEVER]);
Filesystem::getMountManager()->addMount($mount);
- /** @var \OC\Files\Storage\Common $storage */
+ /** @var Common $storage */
$storage = $mount->getStorage();
$watcher = $storage->getWatcher();
$this->assertEquals(Watcher::CHECK_NEVER, $watcher->getPolicy());
@@ -1334,11 +1322,11 @@ class ViewTest extends \Test\TestCase {
* e.g. reading from a folder that's being renamed
*
*
- * @dataProvider dataLockPaths
*
* @param string $rootPath
* @param string $pathPrefix
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataLockPaths')]
public function testReadFromWriteLockedPath($rootPath, $pathPrefix): void {
$this->expectException(LockedException::class);
@@ -1355,11 +1343,11 @@ class ViewTest extends \Test\TestCase {
/**
* Reading from a files_encryption folder that's being renamed
*
- * @dataProvider dataLockPaths
*
* @param string $rootPath
* @param string $pathPrefix
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataLockPaths')]
public function testReadFromWriteUnlockablePath($rootPath, $pathPrefix): void {
$rootPath = str_replace('{folder}', 'files_encryption', $rootPath);
$pathPrefix = str_replace('{folder}', 'files_encryption', $pathPrefix);
@@ -1375,11 +1363,11 @@ class ViewTest extends \Test\TestCase {
* e.g. writing a file that's being downloaded
*
*
- * @dataProvider dataLockPaths
*
* @param string $rootPath
* @param string $pathPrefix
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataLockPaths')]
public function testWriteToReadLockedFile($rootPath, $pathPrefix): void {
$this->expectException(LockedException::class);
@@ -1396,11 +1384,11 @@ class ViewTest extends \Test\TestCase {
/**
* Writing a file that's being downloaded
*
- * @dataProvider dataLockPaths
*
* @param string $rootPath
* @param string $pathPrefix
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataLockPaths')]
public function testWriteToReadUnlockableFile($rootPath, $pathPrefix): void {
$rootPath = str_replace('{folder}', 'files_encryption', $rootPath);
$pathPrefix = str_replace('{folder}', 'files_encryption', $pathPrefix);
@@ -1523,9 +1511,7 @@ class ViewTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider pathRelativeToFilesProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('pathRelativeToFilesProvider')]
public function testGetPathRelativeToFiles($path, $expectedPath): void {
$view = new View();
$this->assertEquals($expectedPath, $view->getPathRelativeToFiles($path));
@@ -1542,9 +1528,9 @@ class ViewTest extends \Test\TestCase {
}
/**
- * @dataProvider pathRelativeToFilesProviderExceptionCases
* @param string $path
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('pathRelativeToFilesProviderExceptionCases')]
public function testGetPathRelativeToFilesWithInvalidArgument($path): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('$absolutePath must be relative to "files"');
@@ -1587,11 +1573,11 @@ class ViewTest extends \Test\TestCase {
}
/**
- * @dataProvider hookPathProvider
* @param $root
* @param $path
* @param $shouldEmit
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('hookPathProvider')]
public function testHookPaths($root, $path, $shouldEmit): void {
$filesystemReflection = new \ReflectionClass(Filesystem::class);
$defaultRootValue = $filesystemReflection->getProperty('defaultInstance');
@@ -1926,7 +1912,6 @@ class ViewTest extends \Test\TestCase {
/**
* Test whether locks are set before and after the operation
*
- * @dataProvider basicOperationProviderForLocks
*
* @param string $operation operation name on the view
* @param array $operationArgs arguments for the operation
@@ -1938,6 +1923,7 @@ class ViewTest extends \Test\TestCase {
* @param int $expectedStrayLock expected lock after returning, should
* be null (unlock) for most operations
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('basicOperationProviderForLocks')]
public function testLockBasicOperation(
$operation,
$operationArgs,
@@ -2087,12 +2073,12 @@ class ViewTest extends \Test\TestCase {
/**
* Test locks for fopen with fclose at the end
*
- * @dataProvider basicOperationProviderForLocks
*
* @param string $operation operation name on the view
* @param array $operationArgs arguments for the operation
* @param string $path path of the locked item to check
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('basicOperationProviderForLocks')]
public function testLockBasicOperationUnlocksAfterException(
$operation,
$operationArgs,
@@ -2178,13 +2164,13 @@ class ViewTest extends \Test\TestCase {
/**
* Test locks for fopen with fclose at the end
*
- * @dataProvider basicOperationProviderForLocks
*
* @param string $operation operation name on the view
* @param array $operationArgs arguments for the operation
* @param string $path path of the locked item to check
* @param string $hookType hook type
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('basicOperationProviderForLocks')]
public function testLockBasicOperationUnlocksAfterCancelledHook(
$operation,
$operationArgs,
@@ -2223,12 +2209,12 @@ class ViewTest extends \Test\TestCase {
/**
* Test locks for rename or copy operation
*
- * @dataProvider lockFileRenameOrCopyDataProvider
*
* @param string $operation operation to be done on the view
* @param int $expectedLockTypeSourceDuring expected lock type on source file during
* the operation
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('lockFileRenameOrCopyDataProvider')]
public function testLockFileRename($operation, $expectedLockTypeSourceDuring): void {
$view = new View('/' . $this->user . '/files/');
@@ -2413,13 +2399,13 @@ class ViewTest extends \Test\TestCase {
/**
* Test locks for rename or copy operation cross-storage
*
- * @dataProvider lockFileRenameOrCopyCrossStorageDataProvider
*
* @param string $viewOperation operation to be done on the view
* @param string $storageOperation operation to be mocked on the storage
* @param int $expectedLockTypeSourceDuring expected lock type on source file during
* the operation
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('lockFileRenameOrCopyCrossStorageDataProvider')]
public function testLockFileRenameCrossStorage($viewOperation, $storageOperation, $expectedLockTypeSourceDuring): void {
$view = new View('/' . $this->user . '/files/');
@@ -2681,8 +2667,8 @@ class ViewTest extends \Test\TestCase {
/**
* @param string $filter
* @param string[] $expected
- * @dataProvider mimeFilterProvider
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('mimeFilterProvider')]
public function testGetDirectoryContentMimeFilter($filter, $expected): void {
$storage1 = new Temporary();
$root = self::getUniqueID('/');
diff --git a/tests/lib/GlobalScale/ConfigTest.php b/tests/lib/GlobalScale/ConfigTest.php
index 29f33238aaa..447b5886ce3 100644
--- a/tests/lib/GlobalScale/ConfigTest.php
+++ b/tests/lib/GlobalScale/ConfigTest.php
@@ -48,12 +48,12 @@ class ConfigTest extends TestCase {
/**
- * @dataProvider dataTestOnlyInternalFederation
*
* @param bool $gsEnabled
* @param string $gsFederation
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestOnlyInternalFederation')]
public function testOnlyInternalFederation($gsEnabled, $gsFederation, $expected): void {
$gsConfig = $this->getInstance(['isGlobalScaleEnabled']);
diff --git a/tests/lib/Group/ManagerTest.php b/tests/lib/Group/ManagerTest.php
index 526582439a9..8515ef0e3e8 100644
--- a/tests/lib/Group/ManagerTest.php
+++ b/tests/lib/Group/ManagerTest.php
@@ -452,7 +452,7 @@ class ManagerTest extends TestCase {
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$manager->addBackend($backend);
- /** @var \OC\User\User|\PHPUnit\Framework\MockObject\MockObject $user */
+ /** @var User|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$user->method('getUID')
->willReturn('myUID');
@@ -482,7 +482,7 @@ class ManagerTest extends TestCase {
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$manager->addBackend($backend);
- /** @var \OC\User\User|\PHPUnit\Framework\MockObject\MockObject $user */
+ /** @var User|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$user->expects($this->atLeastOnce())
->method('getUID')
diff --git a/tests/lib/HelperStorageTest.php b/tests/lib/HelperStorageTest.php
index a4f09fd306e..140be04ec64 100644
--- a/tests/lib/HelperStorageTest.php
+++ b/tests/lib/HelperStorageTest.php
@@ -9,6 +9,7 @@
namespace Test;
use OC\Files\Filesystem;
+use OC\Files\Storage\Storage;
use OC\Files\Storage\Temporary;
use OC\Files\Storage\Wrapper\Quota;
use OCP\Files\Mount\IMountManager;
@@ -26,9 +27,9 @@ class HelperStorageTest extends \Test\TestCase {
/** @var string */
private $user;
- /** @var \OC\Files\Storage\Storage */
+ /** @var Storage */
private $storageMock;
- /** @var \OC\Files\Storage\Storage */
+ /** @var Storage */
private $storage;
private bool $savedQuotaIncludeExternalStorage;
@@ -71,7 +72,7 @@ class HelperStorageTest extends \Test\TestCase {
* free space
*
* @param int $freeSpace free space value
- * @return \OC\Files\Storage\Storage
+ * @return Storage
*/
private function getStorageMock($freeSpace = 12) {
$this->storageMock = $this->getMockBuilder(Temporary::class)
diff --git a/tests/lib/Hooks/BasicEmitterTest.php b/tests/lib/Hooks/BasicEmitterTest.php
index 26e4ec88bf3..6c00da2eaa3 100644
--- a/tests/lib/Hooks/BasicEmitterTest.php
+++ b/tests/lib/Hooks/BasicEmitterTest.php
@@ -9,6 +9,7 @@
namespace Test\Hooks;
use OC\Hooks\BasicEmitter;
+use OC\Hooks\Emitter;
/**
* Class DummyEmitter
@@ -35,7 +36,7 @@ class EmittedException extends \Exception {
class BasicEmitterTest extends \Test\TestCase {
/**
- * @var \OC\Hooks\Emitter $emitter
+ * @var Emitter $emitter
*/
protected $emitter;
diff --git a/tests/lib/Http/Client/ClientTest.php b/tests/lib/Http/Client/ClientTest.php
index 2c0f982c51c..e76b66b52d7 100644
--- a/tests/lib/Http/Client/ClientTest.php
+++ b/tests/lib/Http/Client/ClientTest.php
@@ -151,9 +151,9 @@ class ClientTest extends \Test\TestCase {
}
/**
- * @dataProvider dataPreventLocalAddress
* @param string $uri
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataPreventLocalAddress')]
public function testPreventLocalAddressDisabledByGlobalConfig(string $uri): void {
$this->config->expects($this->once())
->method('getSystemValueBool')
@@ -164,9 +164,9 @@ class ClientTest extends \Test\TestCase {
}
/**
- * @dataProvider dataPreventLocalAddress
* @param string $uri
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataPreventLocalAddress')]
public function testPreventLocalAddressDisabledByOption(string $uri): void {
$this->config->expects($this->never())
->method('getSystemValueBool');
@@ -177,9 +177,9 @@ class ClientTest extends \Test\TestCase {
}
/**
- * @dataProvider dataPreventLocalAddress
* @param string $uri
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataPreventLocalAddress')]
public function testPreventLocalAddressOnGet(string $uri): void {
$host = parse_url($uri, PHP_URL_HOST);
$this->expectException(LocalServerException::class);
@@ -192,9 +192,9 @@ class ClientTest extends \Test\TestCase {
}
/**
- * @dataProvider dataPreventLocalAddress
* @param string $uri
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataPreventLocalAddress')]
public function testPreventLocalAddressOnHead(string $uri): void {
$host = parse_url($uri, PHP_URL_HOST);
$this->expectException(LocalServerException::class);
@@ -207,9 +207,9 @@ class ClientTest extends \Test\TestCase {
}
/**
- * @dataProvider dataPreventLocalAddress
* @param string $uri
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataPreventLocalAddress')]
public function testPreventLocalAddressOnPost(string $uri): void {
$host = parse_url($uri, PHP_URL_HOST);
$this->expectException(LocalServerException::class);
@@ -222,9 +222,9 @@ class ClientTest extends \Test\TestCase {
}
/**
- * @dataProvider dataPreventLocalAddress
* @param string $uri
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataPreventLocalAddress')]
public function testPreventLocalAddressOnPut(string $uri): void {
$host = parse_url($uri, PHP_URL_HOST);
$this->expectException(LocalServerException::class);
@@ -237,9 +237,9 @@ class ClientTest extends \Test\TestCase {
}
/**
- * @dataProvider dataPreventLocalAddress
* @param string $uri
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataPreventLocalAddress')]
public function testPreventLocalAddressOnDelete(string $uri): void {
$host = parse_url($uri, PHP_URL_HOST);
$this->expectException(LocalServerException::class);
diff --git a/tests/lib/ImageTest.php b/tests/lib/ImageTest.php
index b398b42ea98..02181fffff9 100644
--- a/tests/lib/ImageTest.php
+++ b/tests/lib/ImageTest.php
@@ -281,12 +281,12 @@ class ImageTest extends \Test\TestCase {
}
/**
- * @dataProvider sampleProvider
*
* @param string $filename
* @param int[] $asked
* @param int[] $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('sampleProvider')]
public function testFitIn($filename, $asked, $expected): void {
$img = new Image();
$img->loadFromFile(OC::$SERVERROOT . '/tests/data/' . $filename);
@@ -306,10 +306,10 @@ class ImageTest extends \Test\TestCase {
/**
* Image should not be resized if it's already smaller than what is required
*
- * @dataProvider sampleFilenamesProvider
*
* @param string $filename
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('sampleFilenamesProvider')]
public function testScaleDownToFitWhenSmallerAlready($filename): void {
$img = new Image();
$img->loadFromFile(OC::$SERVERROOT . '/tests/data/' . $filename);
@@ -337,12 +337,12 @@ class ImageTest extends \Test\TestCase {
}
/**
- * @dataProvider largeSampleProvider
*
* @param string $filename
* @param int[] $asked
* @param int[] $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('largeSampleProvider')]
public function testScaleDownWhenBigger($filename, $asked, $expected): void {
$img = new Image();
$img->loadFromFile(OC::$SERVERROOT . '/tests/data/' . $filename);
@@ -360,9 +360,7 @@ class ImageTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider convertDataProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('convertDataProvider')]
public function testConvert($mimeType): void {
$img = new Image();
$img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.png');
diff --git a/tests/lib/InfoXmlTest.php b/tests/lib/InfoXmlTest.php
index 6806ddf8d06..e92ee5b9c09 100644
--- a/tests/lib/InfoXmlTest.php
+++ b/tests/lib/InfoXmlTest.php
@@ -50,10 +50,9 @@ class InfoXmlTest extends TestCase {
}
/**
- * @dataProvider dataApps
- *
* @param string $app
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataApps')]
public function testClasses($app): void {
$appInfo = $this->appManager->getAppInfo($app);
$appPath = $this->appManager->getAppPath($app);
diff --git a/tests/lib/InitialStateServiceTest.php b/tests/lib/InitialStateServiceTest.php
index 5e0f7c7b55e..9081aa93b84 100644
--- a/tests/lib/InitialStateServiceTest.php
+++ b/tests/lib/InitialStateServiceTest.php
@@ -49,9 +49,7 @@ class InitialStateServiceTest extends TestCase {
];
}
- /**
- * @dataProvider staticData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('staticData')]
public function testStaticData(mixed $value): void {
$this->service->provideInitialState('test', 'key', $value);
$data = $this->service->getInitialStates();
@@ -88,9 +86,7 @@ class InitialStateServiceTest extends TestCase {
);
}
- /**
- * @dataProvider staticData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('staticData')]
public function testLazyData(mixed $value): void {
$this->service->provideLazyInitialState('test', 'key', function () use ($value) {
return $value;
diff --git a/tests/lib/InstallerTest.php b/tests/lib/InstallerTest.php
index c7f9699eb10..1813d2cd151 100644
--- a/tests/lib/InstallerTest.php
+++ b/tests/lib/InstallerTest.php
@@ -147,10 +147,10 @@ class InstallerTest extends TestCase {
}
/**
- * @dataProvider updateArrayProvider
* @param array $appArray
* @param string|bool $updateAvailable
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('updateArrayProvider')]
public function testIsUpdateAvailable(array $appArray, $updateAvailable): void {
$this->appFetcher
->expects($this->once())
diff --git a/tests/lib/IntegrityCheck/CheckerTest.php b/tests/lib/IntegrityCheck/CheckerTest.php
index e08e07bb8cd..a8a2596a3d8 100644
--- a/tests/lib/IntegrityCheck/CheckerTest.php
+++ b/tests/lib/IntegrityCheck/CheckerTest.php
@@ -1079,8 +1079,8 @@ class CheckerTest extends TestCase {
/**
* @param string $channel
* @param bool $isCodeSigningEnforced
- * @dataProvider channelDataProvider
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('channelDataProvider')]
public function testIsCodeCheckEnforced($channel, $isCodeSigningEnforced): void {
$this->serverVersion
->expects($this->once())
@@ -1097,8 +1097,8 @@ class CheckerTest extends TestCase {
/**
* @param string $channel
- * @dataProvider channelDataProvider
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('channelDataProvider')]
public function testIsCodeCheckEnforcedWithDisabledConfigSwitch($channel): void {
$this->serverVersion
->expects($this->once())
diff --git a/tests/lib/IntegrityCheck/Iterator/ExcludeFileByNameFilterIteratorTest.php b/tests/lib/IntegrityCheck/Iterator/ExcludeFileByNameFilterIteratorTest.php
index f6507a6ee3d..dfd0941bd20 100644
--- a/tests/lib/IntegrityCheck/Iterator/ExcludeFileByNameFilterIteratorTest.php
+++ b/tests/lib/IntegrityCheck/Iterator/ExcludeFileByNameFilterIteratorTest.php
@@ -36,10 +36,10 @@ class ExcludeFileByNameFilterIteratorTest extends TestCase {
}
/**
- * @dataProvider fileNameProvider
* @param string $fileName
* @param bool $expectedResult
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('fileNameProvider')]
public function testAcceptForFiles($fileName, $expectedResult): void {
$iteratorMock = $this->getMockBuilder(\RecursiveDirectoryIterator::class)
->disableOriginalConstructor()
@@ -58,10 +58,10 @@ class ExcludeFileByNameFilterIteratorTest extends TestCase {
}
/**
- * @dataProvider fileNameProvider
* @param string $fileName
* @param bool $expectedResult
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('fileNameProvider')]
public function testAcceptForDirs($fileName, $expectedResult): void {
$iteratorMock = $this->getMockBuilder(\RecursiveDirectoryIterator::class)
->disableOriginalConstructor()
diff --git a/tests/lib/L10N/FactoryTest.php b/tests/lib/L10N/FactoryTest.php
index cd66217c49d..8c15baba9f6 100644
--- a/tests/lib/L10N/FactoryTest.php
+++ b/tests/lib/L10N/FactoryTest.php
@@ -278,10 +278,9 @@ class FactoryTest extends TestCase {
}
/**
- * @dataProvider dataFindAvailableLanguages
- *
* @param string|null $app
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataFindAvailableLanguages')]
public function testFindAvailableLanguages($app): void {
$factory = $this->getFactory(['findL10nDir']);
$factory->expects(self::once())
@@ -324,13 +323,13 @@ class FactoryTest extends TestCase {
}
/**
- * @dataProvider dataLanguageExists
*
* @param string|null $app
* @param string $lang
* @param string[] $availableLanguages
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataLanguageExists')]
public function testLanguageExists($app, $lang, array $availableLanguages, $expected): void {
$factory = $this->getFactory(['findAvailableLanguages']);
$factory->expects(($lang === 'en') ? self::never() : self::once())
@@ -364,13 +363,13 @@ class FactoryTest extends TestCase {
}
/**
- * @dataProvider dataSetLanguageFromRequest
*
* @param string|null $app
* @param string $header
* @param string[] $availableLanguages
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetLanguageFromRequest')]
public function testGetLanguageFromRequest($app, $header, array $availableLanguages, $expected): void {
$factory = $this->getFactory(['findAvailableLanguages', 'respectDefaultLanguage']);
$factory->expects(self::once())
@@ -409,11 +408,11 @@ class FactoryTest extends TestCase {
}
/**
- * @dataProvider dataGetL10nFilesForApp
*
* @param string $app
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetL10nFilesForApp')]
public function testGetL10nFilesForApp($app, $lang, $expected): void {
$factory = $this->getFactory();
if (in_array($app, ['settings','files'])) {
@@ -442,11 +441,11 @@ class FactoryTest extends TestCase {
}
/**
- * @dataProvider dataFindL10NDir
*
* @param string $app
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataFindL10NDir')]
public function testFindL10NDir($app, $expected): void {
$factory = $this->getFactory();
if (in_array($app, ['settings','files'])) {
@@ -479,12 +478,12 @@ class FactoryTest extends TestCase {
}
/**
- * @dataProvider dataFindLanguage
*
* @param bool $loggedIn
* @param array $availableLang
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataFindLanguage')]
public function testFindLanguage($loggedIn, $availableLang, $expected): void {
$userLang = 'nl';
$browserLang = 'de';
@@ -671,13 +670,13 @@ class FactoryTest extends TestCase {
/**
* test if we respect default language if possible
*
- * @dataProvider dataTestRespectDefaultLanguage
*
* @param string $lang
* @param string $defaultLanguage
* @param bool $langExists
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestRespectDefaultLanguage')]
public function testRespectDefaultLanguage($lang, $defaultLanguage, $langExists, $expected): void {
$factory = $this->getFactory(['languageExists']);
$factory->expects(self::any())
@@ -703,13 +702,13 @@ class FactoryTest extends TestCase {
* - if available languages set is not reduced to an empty set if
* the reduce config is an empty set
*
- * @dataProvider dataTestReduceToLanguages
*
* @param string $lang
* @param array $availableLanguages
* @param array $reducedLanguageSet
* @param array $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestReduceToLanguages')]
public function testReduceLanguagesByConfiguration(string $lang, array $availableLanguages, array $reducedLanguageSet, array $expected): void {
$factory = $this->getFactory(['findAvailableLanguages', 'languageExists']);
$factory->expects(self::any())
@@ -744,9 +743,7 @@ class FactoryTest extends TestCase {
];
}
- /**
- * @dataProvider languageIteratorRequestProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('languageIteratorRequestProvider')]
public function testGetLanguageIterator(bool $hasSession, bool $mockUser): void {
$factory = $this->getFactory();
$user = null;
@@ -777,9 +774,7 @@ class FactoryTest extends TestCase {
];
}
- /**
- * @dataProvider dataGetLanguageDirection
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetLanguageDirection')]
public function testGetLanguageDirection(string $language, string $expectedDirection) {
$factory = $this->getFactory();
diff --git a/tests/lib/L10N/L10nTest.php b/tests/lib/L10N/L10nTest.php
index 33e47d08410..842f1bc5eda 100644
--- a/tests/lib/L10N/L10nTest.php
+++ b/tests/lib/L10N/L10nTest.php
@@ -31,9 +31,9 @@ class L10nTest extends TestCase {
* @return Factory
*/
protected function getFactory() {
- /** @var \OCP\IConfig $config */
+ /** @var IConfig $config */
$config = $this->createMock(IConfig::class);
- /** @var \OCP\IRequest $request */
+ /** @var IRequest $request */
$request = $this->createMock(IRequest::class);
/** @var IUserSession $userSession */
$userSession = $this->createMock(IUserSession::class);
@@ -108,11 +108,11 @@ class L10nTest extends TestCase {
}
/**
- * @dataProvider dataPlaceholders
*
* @param $string
* @param $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataPlaceholders')]
public function testPlaceholders($string, $expected): void {
$transFile = \OC::$SERVERROOT . '/tests/data/l10n/de.json';
$l = new L10N($this->getFactory(), 'test', 'de', 'de_AT', [$transFile]);
@@ -156,9 +156,7 @@ class L10nTest extends TestCase {
];
}
- /**
- * @dataProvider localizationData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('localizationData')]
public function testNumericStringLocalization($expectedDate, $lang, $locale, $type, $value): void {
$l = new L10N($this->getFactory(), 'test', $lang, $locale, []);
$this->assertSame($expectedDate, $l->l($type, $value));
@@ -172,11 +170,11 @@ class L10nTest extends TestCase {
}
/**
- * @dataProvider firstDayData
* @param $expected
* @param $lang
* @param $locale
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('firstDayData')]
public function testFirstWeekDay($expected, $lang, $locale): void {
$l = new L10N($this->getFactory(), 'test', $lang, $locale, []);
$this->assertSame($expected, $l->l('firstday', 'firstday'));
@@ -190,11 +188,11 @@ class L10nTest extends TestCase {
}
/**
- * @dataProvider jsDateData
* @param $expected
* @param $lang
* @param $locale
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('jsDateData')]
public function testJSDate($expected, $lang, $locale): void {
$l = new L10N($this->getFactory(), 'test', $lang, $locale, []);
$this->assertSame($expected, $l->l('jsdate', 'jsdate'));
@@ -216,10 +214,10 @@ class L10nTest extends TestCase {
}
/**
- * @dataProvider findLanguageFromLocaleData
* @param $locale
* @param $language
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('findLanguageFromLocaleData')]
public function testFindLanguageFromLocale($locale, $language): void {
$this->assertEquals(
$language,
diff --git a/tests/lib/L10N/LanguageIteratorTest.php b/tests/lib/L10N/LanguageIteratorTest.php
index a91a587b0e2..4d1c666cc42 100644
--- a/tests/lib/L10N/LanguageIteratorTest.php
+++ b/tests/lib/L10N/LanguageIteratorTest.php
@@ -58,9 +58,7 @@ class LanguageIteratorTest extends TestCase {
];
}
- /**
- * @dataProvider languageSettingsProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('languageSettingsProvider')]
public function testIterator($forcedLang, $userLang, $sysLang, $expectedValues): void {
$this->config->expects($this->any())
->method('getSystemValue')
diff --git a/tests/lib/LargeFileHelperGetFileSizeTest.php b/tests/lib/LargeFileHelperGetFileSizeTest.php
index eb79994ea94..fbf22f1eb87 100644
--- a/tests/lib/LargeFileHelperGetFileSizeTest.php
+++ b/tests/lib/LargeFileHelperGetFileSizeTest.php
@@ -39,9 +39,7 @@ class LargeFileHelperGetFileSizeTest extends TestCase {
];
}
- /**
- * @dataProvider dataFileNameProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataFileNameProvider')]
public function XtestGetFileSizeViaCurl($filename, $fileSize) {
if (!extension_loaded('curl')) {
$this->markTestSkipped(
@@ -59,9 +57,7 @@ class LargeFileHelperGetFileSizeTest extends TestCase {
);
}
- /**
- * @dataProvider dataFileNameProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataFileNameProvider')]
public function testGetFileSizeViaExec($filename, $fileSize): void {
if (escapeshellarg('strรคngรฉ') !== '\'strรคngรฉ\'') {
$this->markTestSkipped('Your escapeshell args removes accents');
@@ -77,9 +73,7 @@ class LargeFileHelperGetFileSizeTest extends TestCase {
);
}
- /**
- * @dataProvider dataFileNameProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataFileNameProvider')]
public function testGetFileSizeNative($filename, $fileSize): void {
$this->assertSame(
$fileSize,
diff --git a/tests/lib/LegacyHelperTest.php b/tests/lib/LegacyHelperTest.php
index 858069410ff..c18f929e40c 100644
--- a/tests/lib/LegacyHelperTest.php
+++ b/tests/lib/LegacyHelperTest.php
@@ -116,9 +116,7 @@ class LegacyHelperTest extends \Test\TestCase {
$this->assertEquals('dir/filename(1) (2) (4).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename(1) (2) (3).ext', $viewMock));
}
- /**
- * @dataProvider streamCopyDataProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('streamCopyDataProvider')]
public function testStreamCopy($expectedCount, $expectedResult, $source, $target): void {
if (is_string($source)) {
$source = fopen($source, 'r');
diff --git a/tests/lib/Lock/DBLockingProviderTest.php b/tests/lib/Lock/DBLockingProviderTest.php
index cef68369cc4..32a223b4913 100644
--- a/tests/lib/Lock/DBLockingProviderTest.php
+++ b/tests/lib/Lock/DBLockingProviderTest.php
@@ -28,12 +28,12 @@ class DBLockingProviderTest extends LockingProvider {
protected $instance;
/**
- * @var \OCP\IDBConnection
+ * @var IDBConnection
*/
protected $connection;
/**
- * @var \OCP\AppFramework\Utility\ITimeFactory
+ * @var ITimeFactory
*/
protected $timeFactory;
@@ -51,7 +51,7 @@ class DBLockingProviderTest extends LockingProvider {
}
/**
- * @return \OCP\Lock\ILockingProvider
+ * @return ILockingProvider
*/
protected function getInstance() {
$this->connection = Server::get(IDBConnection::class);
diff --git a/tests/lib/Lock/LockingProvider.php b/tests/lib/Lock/LockingProvider.php
index 68062880223..2827f2c9160 100644
--- a/tests/lib/Lock/LockingProvider.php
+++ b/tests/lib/Lock/LockingProvider.php
@@ -14,12 +14,12 @@ use Test\TestCase;
abstract class LockingProvider extends TestCase {
/**
- * @var \OCP\Lock\ILockingProvider
+ * @var ILockingProvider
*/
protected $instance;
/**
- * @return \OCP\Lock\ILockingProvider
+ * @return ILockingProvider
*/
abstract protected function getInstance();
diff --git a/tests/lib/Lock/MemcacheLockingProviderTest.php b/tests/lib/Lock/MemcacheLockingProviderTest.php
index 91f9c8811ed..ea7b3c26b3c 100644
--- a/tests/lib/Lock/MemcacheLockingProviderTest.php
+++ b/tests/lib/Lock/MemcacheLockingProviderTest.php
@@ -11,16 +11,18 @@ namespace Test\Lock;
use OC\Lock\MemcacheLockingProvider;
use OC\Memcache\ArrayCache;
use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\IMemcache;
+use OCP\Lock\ILockingProvider;
use OCP\Server;
class MemcacheLockingProviderTest extends LockingProvider {
/**
- * @var \OCP\IMemcache
+ * @var IMemcache
*/
private $memcache;
/**
- * @return \OCP\Lock\ILockingProvider
+ * @return ILockingProvider
*/
protected function getInstance() {
$this->memcache = new ArrayCache();
diff --git a/tests/lib/Lock/NonCachingDBLockingProviderTest.php b/tests/lib/Lock/NonCachingDBLockingProviderTest.php
index 537afbd34fc..4f05f0ba892 100644
--- a/tests/lib/Lock/NonCachingDBLockingProviderTest.php
+++ b/tests/lib/Lock/NonCachingDBLockingProviderTest.php
@@ -19,7 +19,7 @@ use OCP\Server;
*/
class NonCachingDBLockingProviderTest extends DBLockingProviderTest {
/**
- * @return \OCP\Lock\ILockingProvider
+ * @return ILockingProvider
*/
protected function getInstance() {
$this->connection = Server::get(IDBConnection::class);
diff --git a/tests/lib/Log/LogFactoryTest.php b/tests/lib/Log/LogFactoryTest.php
index a3549ad7145..b1adbd0e823 100644
--- a/tests/lib/Log/LogFactoryTest.php
+++ b/tests/lib/Log/LogFactoryTest.php
@@ -13,6 +13,7 @@ use OC\Log\LogFactory;
use OC\Log\Syslog;
use OC\Log\Systemdlog;
use OC\SystemConfig;
+use OCP\AppFramework\QueryException;
use OCP\IServerContainer;
use Test\TestCase;
@@ -59,9 +60,9 @@ class LogFactoryTest extends TestCase {
/**
* @param string $type
- * @dataProvider fileTypeProvider
- * @throws \OCP\AppFramework\QueryException
+ * @throws QueryException
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('fileTypeProvider')]
public function testFile(string $type): void {
$datadir = \OC::$SERVERROOT . '/data';
$defaultLog = $datadir . '/nextcloud.log';
@@ -92,9 +93,9 @@ class LogFactoryTest extends TestCase {
}
/**
- * @dataProvider logFilePathProvider
- * @throws \OCP\AppFramework\QueryException
+ * @throws QueryException
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('logFilePathProvider')]
public function testFileCustomPath($path, $expected): void {
$datadir = \OC::$SERVERROOT . '/data';
$defaultLog = $datadir . '/nextcloud.log';
@@ -113,7 +114,7 @@ class LogFactoryTest extends TestCase {
}
/**
- * @throws \OCP\AppFramework\QueryException
+ * @throws QueryException
*/
public function testErrorLog(): void {
$log = $this->factory->get('errorlog');
@@ -121,7 +122,7 @@ class LogFactoryTest extends TestCase {
}
/**
- * @throws \OCP\AppFramework\QueryException
+ * @throws QueryException
*/
public function testSystemLog(): void {
$this->c->expects($this->once())
@@ -134,7 +135,7 @@ class LogFactoryTest extends TestCase {
}
/**
- * @throws \OCP\AppFramework\QueryException
+ * @throws QueryException
*/
public function testSystemdLog(): void {
$this->c->expects($this->once())
diff --git a/tests/lib/Log/PsrLoggerAdapterTest.php b/tests/lib/Log/PsrLoggerAdapterTest.php
index 9a159ba537d..c11af7a12c2 100644
--- a/tests/lib/Log/PsrLoggerAdapterTest.php
+++ b/tests/lib/Log/PsrLoggerAdapterTest.php
@@ -28,9 +28,7 @@ class PsrLoggerAdapterTest extends TestCase {
$this->loggerAdapter = new PsrLoggerAdapter($this->logger);
}
- /**
- * @dataProvider dataPsrLoggingLevels
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataPsrLoggingLevels')]
public function testLoggingWithPsrLogLevels(string $level, int $expectedLevel): void {
$this->logger->expects(self::once())
->method('log')
@@ -38,9 +36,7 @@ class PsrLoggerAdapterTest extends TestCase {
$this->loggerAdapter->log($level, 'test message', ['app' => 'test']);
}
- /**
- * @dataProvider dataPsrLoggingLevels
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataPsrLoggingLevels')]
public function testLogLevelToInt(string $level, int $expectedLevel): void {
$this->assertEquals($expectedLevel, PsrLoggerAdapter::logLevelToInt($level));
}
@@ -58,9 +54,7 @@ class PsrLoggerAdapterTest extends TestCase {
];
}
- /**
- * @dataProvider dataInvalidLoggingLevel
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataInvalidLoggingLevel')]
public function testInvalidLoggingLevel($level): void {
$this->logger->expects(self::never())
->method('log');
diff --git a/tests/lib/LoggerTest.php b/tests/lib/LoggerTest.php
index 8c3cb85116b..7ad6638537f 100644
--- a/tests/lib/LoggerTest.php
+++ b/tests/lib/LoggerTest.php
@@ -131,9 +131,7 @@ class LoggerTest extends TestCase implements IWriter {
];
}
- /**
- * @dataProvider dataMatchesCondition
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataMatchesCondition')]
public function testMatchesCondition(string $userId, array $conditions, array $expectedLogs): void {
$this->config->expects($this->any())
->method('getValue')
@@ -195,9 +193,7 @@ class LoggerTest extends TestCase implements IWriter {
];
}
- /**
- * @dataProvider userAndPasswordData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('userAndPasswordData')]
public function testDetectlogin(string $user, string $password): void {
$this->mockDefaultLogLevel();
$e = new \Exception('test');
@@ -218,9 +214,7 @@ class LoggerTest extends TestCase implements IWriter {
}
}
- /**
- * @dataProvider userAndPasswordData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('userAndPasswordData')]
public function testDetectcheckPassword(string $user, string $password): void {
$this->mockDefaultLogLevel();
$e = new \Exception('test');
@@ -241,9 +235,7 @@ class LoggerTest extends TestCase implements IWriter {
}
}
- /**
- * @dataProvider userAndPasswordData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('userAndPasswordData')]
public function testDetectvalidateUserPass(string $user, string $password): void {
$this->mockDefaultLogLevel();
$e = new \Exception('test');
@@ -264,9 +256,7 @@ class LoggerTest extends TestCase implements IWriter {
}
}
- /**
- * @dataProvider userAndPasswordData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('userAndPasswordData')]
public function testDetecttryLogin(string $user, string $password): void {
$this->mockDefaultLogLevel();
$e = new \Exception('test');
@@ -287,9 +277,7 @@ class LoggerTest extends TestCase implements IWriter {
}
}
- /**
- * @dataProvider userAndPasswordData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('userAndPasswordData')]
public function testDetectclosure(string $user, string $password): void {
$this->mockDefaultLogLevel();
$a = function ($user, $password): void {
diff --git a/tests/lib/Mail/MailerTest.php b/tests/lib/Mail/MailerTest.php
index e807e6e31b2..7b911e5c4e2 100644
--- a/tests/lib/Mail/MailerTest.php
+++ b/tests/lib/Mail/MailerTest.php
@@ -76,10 +76,10 @@ class MailerTest extends TestCase {
}
/**
- * @dataProvider sendmailModeProvider
* @param $sendmailMode
* @param $binaryParam
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('sendmailModeProvider')]
public function testGetSendmailInstanceSendMail($sendmailMode, $binaryParam): void {
$this->config
->expects($this->exactly(2))
@@ -99,10 +99,10 @@ class MailerTest extends TestCase {
}
/**
- * @dataProvider sendmailModeProvider
* @param $sendmailMode
* @param $binaryParam
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('sendmailModeProvider')]
public function testGetSendmailInstanceSendMailQmail($sendmailMode, $binaryParam): void {
$this->config
->expects($this->exactly(2))
@@ -243,9 +243,7 @@ class MailerTest extends TestCase {
];
}
- /**
- * @dataProvider mailAddressProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('mailAddressProvider')]
public function testValidateMailAddress($email, $expected, $strict): void {
$this->config
->expects($this->atMost(1))
diff --git a/tests/lib/Mail/MessageTest.php b/tests/lib/Mail/MessageTest.php
index c975b552533..18ef9793b5b 100644
--- a/tests/lib/Mail/MessageTest.php
+++ b/tests/lib/Mail/MessageTest.php
@@ -72,11 +72,11 @@ class MessageTest extends TestCase {
}
/**
- * @dataProvider mailAddressProvider
*
* @param string $unconverted
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('mailAddressProvider')]
public function testConvertAddresses($unconverted, $expected): void {
$this->assertEquals($expected, self::invokePrivate($this->message, 'convertAddresses', [$unconverted]));
}
diff --git a/tests/lib/Memcache/Cache.php b/tests/lib/Memcache/Cache.php
index 5845d426311..b48f5557faa 100644
--- a/tests/lib/Memcache/Cache.php
+++ b/tests/lib/Memcache/Cache.php
@@ -8,9 +8,11 @@
namespace Test\Memcache;
+use OCP\IMemcache;
+
abstract class Cache extends \Test\Cache\TestCache {
/**
- * @var \OCP\IMemcache cache;
+ * @var IMemcache cache;
*/
protected $instance;
diff --git a/tests/lib/Memcache/FactoryTest.php b/tests/lib/Memcache/FactoryTest.php
index 14b47a20103..e16e079349f 100644
--- a/tests/lib/Memcache/FactoryTest.php
+++ b/tests/lib/Memcache/FactoryTest.php
@@ -106,9 +106,7 @@ class FactoryTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider cacheAvailabilityProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('cacheAvailabilityProvider')]
public function testCacheAvailability($localCache, $distributedCache, $lockingCache,
$expectedLocalCache, $expectedDistributedCache, $expectedLockingCache): void {
$logger = $this->getMockBuilder(LoggerInterface::class)->getMock();
@@ -119,9 +117,7 @@ class FactoryTest extends \Test\TestCase {
$this->assertTrue(is_a($factory->createLocking(), $expectedLockingCache));
}
- /**
- * @dataProvider cacheUnavailableProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('cacheUnavailableProvider')]
public function testCacheNotAvailableException($localCache, $distributedCache): void {
$this->expectException(HintException::class);
diff --git a/tests/lib/MemoryInfoTest.php b/tests/lib/MemoryInfoTest.php
index a81a5ebcaeb..13e46c96601 100644
--- a/tests/lib/MemoryInfoTest.php
+++ b/tests/lib/MemoryInfoTest.php
@@ -52,8 +52,8 @@ class MemoryInfoTest extends TestCase {
*
* @param string $iniValue The "memory_limit" ini data.
* @param int|float $expected The expected detected memory limit.
- * @dataProvider getMemoryLimitTestData
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('getMemoryLimitTestData')]
public function testMemoryLimit(string $iniValue, int|float $expected): void {
ini_set('memory_limit', $iniValue);
$memoryInfo = new MemoryInfo();
@@ -74,8 +74,8 @@ class MemoryInfoTest extends TestCase {
*
* @param int $memoryLimit The memory limit
* @param bool $expected If the memory limit is sufficient.
- * @dataProvider getSufficientMemoryTestData
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('getSufficientMemoryTestData')]
public function testIsMemoryLimitSufficient(int $memoryLimit, bool $expected): void {
/* @var MemoryInfo|MockObject $memoryInfo */
$memoryInfo = $this->getMockBuilder(MemoryInfo::class)
diff --git a/tests/lib/NaturalSortTest.php b/tests/lib/NaturalSortTest.php
index b4890041c20..48d09f03087 100644
--- a/tests/lib/NaturalSortTest.php
+++ b/tests/lib/NaturalSortTest.php
@@ -12,9 +12,7 @@ use OC\NaturalSort;
use OC\NaturalSort_DefaultCollator;
class NaturalSortTest extends \Test\TestCase {
- /**
- * @dataProvider naturalSortDataProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('naturalSortDataProvider')]
public function testNaturalSortCompare($array, $sorted): void {
if (!class_exists('Collator')) {
$this->markTestSkipped('The intl module is not available, natural sorting might not work as expected.');
@@ -25,9 +23,7 @@ class NaturalSortTest extends \Test\TestCase {
$this->assertEquals($sorted, $array);
}
- /**
- * @dataProvider defaultCollatorDataProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('defaultCollatorDataProvider')]
public function testDefaultCollatorCompare($array, $sorted): void {
$comparator = new NaturalSort(new NaturalSort_DefaultCollator());
usort($array, [$comparator, 'compare']);
diff --git a/tests/lib/NavigationManagerTest.php b/tests/lib/NavigationManagerTest.php
index dbc3b0419c7..53d7e81302b 100644
--- a/tests/lib/NavigationManagerTest.php
+++ b/tests/lib/NavigationManagerTest.php
@@ -41,7 +41,7 @@ class NavigationManagerTest extends TestCase {
protected IEVentDispatcher|MockObject $dispatcher;
- /** @var \OC\NavigationManager */
+ /** @var NavigationManager */
protected $navigationManager;
protected LoggerInterface $logger;
@@ -122,11 +122,11 @@ class NavigationManagerTest extends TestCase {
}
/**
- * @dataProvider addArrayData
*
* @param array $entry
* @param array $expectedEntry
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('addArrayData')]
public function testAddArray(array $entry, array $expectedEntry): void {
$this->assertEmpty($this->navigationManager->getAll('all'), 'Expected no navigation entry exists');
$this->navigationManager->add($entry);
@@ -140,11 +140,11 @@ class NavigationManagerTest extends TestCase {
}
/**
- * @dataProvider addArrayData
*
* @param array $entry
* @param array $expectedEntry
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('addArrayData')]
public function testAddClosure(array $entry, array $expectedEntry): void {
global $testAddClosureNumberOfCalls;
$testAddClosureNumberOfCalls = 0;
@@ -215,9 +215,7 @@ class NavigationManagerTest extends TestCase {
$this->assertEquals(0, $testAddClosureNumberOfCalls, 'Expected that the closure is not called by getAll()');
}
- /**
- * @dataProvider providesNavigationConfig
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providesNavigationConfig')]
public function testWithAppManager($expected, $navigation, $isAdmin = false): void {
$l = $this->createMock(IL10N::class);
$l->expects($this->any())->method('t')->willReturnCallback(function ($text, $parameters = []) {
@@ -731,9 +729,7 @@ class NavigationManagerTest extends TestCase {
];
}
- /**
- * @dataProvider provideDefaultEntries
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('provideDefaultEntries')]
public function testGetDefaultEntryIdForUser(string $defaultApps, string $userDefaultApps, string $userApporder, bool $withFallbacks, string $expectedApp): void {
$this->navigationManager->add([
'id' => 'files',
diff --git a/tests/lib/Net/HostnameClassifierTest.php b/tests/lib/Net/HostnameClassifierTest.php
index 5d80da01e46..c03afdabe83 100644
--- a/tests/lib/Net/HostnameClassifierTest.php
+++ b/tests/lib/Net/HostnameClassifierTest.php
@@ -32,9 +32,7 @@ class HostnameClassifierTest extends TestCase {
];
}
- /**
- * @dataProvider localHostnamesData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('localHostnamesData')]
public function testLocalHostname(string $host): void {
$isLocal = $this->classifier->isLocalHostname($host);
@@ -51,9 +49,7 @@ class HostnameClassifierTest extends TestCase {
];
}
- /**
- * @dataProvider publicHostnamesData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('publicHostnamesData')]
public function testPublicHostname(string $host): void {
$isLocal = $this->classifier->isLocalHostname($host);
diff --git a/tests/lib/Net/IpAddressClassifierTest.php b/tests/lib/Net/IpAddressClassifierTest.php
index be0b7e52fe0..f20e1ec1785 100644
--- a/tests/lib/Net/IpAddressClassifierTest.php
+++ b/tests/lib/Net/IpAddressClassifierTest.php
@@ -30,9 +30,7 @@ class IpAddressClassifierTest extends TestCase {
];
}
- /**
- * @dataProvider publicIpAddressData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('publicIpAddressData')]
public function testPublicAddress(string $ip): void {
$isLocal = $this->classifier->isLocalAddress($ip);
@@ -54,9 +52,7 @@ class IpAddressClassifierTest extends TestCase {
];
}
- /**
- * @dataProvider localIpAddressData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('localIpAddressData')]
public function testLocalAddress(string $ip): void {
$isLocal = $this->classifier->isLocalAddress($ip);
diff --git a/tests/lib/Notification/ActionTest.php b/tests/lib/Notification/ActionTest.php
index e902db25d43..252819f1e29 100644
--- a/tests/lib/Notification/ActionTest.php
+++ b/tests/lib/Notification/ActionTest.php
@@ -30,9 +30,9 @@ class ActionTest extends TestCase {
}
/**
- * @dataProvider dataSetLabel
* @param string $label
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetLabel')]
public function testSetLabel($label): void {
$this->assertSame('', $this->action->getLabel());
$this->assertSame($this->action, $this->action->setLabel($label));
@@ -47,10 +47,10 @@ class ActionTest extends TestCase {
}
/**
- * @dataProvider dataSetLabelInvalid
* @param mixed $label
*
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetLabelInvalid')]
public function testSetLabelInvalid($label): void {
$this->expectException(\InvalidArgumentException::class);
@@ -66,9 +66,9 @@ class ActionTest extends TestCase {
}
/**
- * @dataProvider dataSetParsedLabel
* @param string $label
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetParsedLabel')]
public function testSetParsedLabel($label): void {
$this->assertSame('', $this->action->getParsedLabel());
$this->assertSame($this->action, $this->action->setParsedLabel($label));
@@ -82,10 +82,10 @@ class ActionTest extends TestCase {
}
/**
- * @dataProvider dataSetParsedLabelInvalid
* @param mixed $label
*
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetParsedLabelInvalid')]
public function testSetParsedLabelInvalid($label): void {
$this->expectException(\InvalidArgumentException::class);
@@ -102,10 +102,10 @@ class ActionTest extends TestCase {
}
/**
- * @dataProvider dataSetLink
* @param string $link
* @param string $type
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetLink')]
public function testSetLink($link, $type): void {
$this->assertSame('', $this->action->getLink());
$this->assertSame($this->action, $this->action->setLink($link, $type));
@@ -125,11 +125,11 @@ class ActionTest extends TestCase {
}
/**
- * @dataProvider dataSetLinkInvalid
* @param mixed $link
* @param mixed $type
*
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetLinkInvalid')]
public function testSetLinkInvalid($link, $type): void {
$this->expectException(\InvalidArgumentException::class);
@@ -144,9 +144,9 @@ class ActionTest extends TestCase {
}
/**
- * @dataProvider dataSetPrimary
* @param bool $primary
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetPrimary')]
public function testSetPrimary($primary): void {
$this->assertSame(false, $this->action->isPrimary());
$this->assertSame($this->action, $this->action->setPrimary($primary));
diff --git a/tests/lib/Notification/ManagerTest.php b/tests/lib/Notification/ManagerTest.php
index 418d642317e..cbd76989d24 100644
--- a/tests/lib/Notification/ManagerTest.php
+++ b/tests/lib/Notification/ManagerTest.php
@@ -256,11 +256,11 @@ class ManagerTest extends TestCase {
}
/**
- * @dataProvider dataIsFairUseOfFreePushService
* @param bool $hasValidSubscription
* @param int $userCount
* @param bool $isFair
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataIsFairUseOfFreePushService')]
public function testIsFairUseOfFreePushService(bool $hasValidSubscription, int $userCount, bool $isFair): void {
$this->subscriptionRegistry->method('delegateHasValidSubscription')
->willReturn($hasValidSubscription);
diff --git a/tests/lib/Notification/NotificationTest.php b/tests/lib/Notification/NotificationTest.php
index 93b1746be3c..cebe9d51021 100644
--- a/tests/lib/Notification/NotificationTest.php
+++ b/tests/lib/Notification/NotificationTest.php
@@ -57,9 +57,9 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataSetApp
* @param string $app
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetApp')]
public function testSetApp($app): void {
$this->assertSame('', $this->notification->getApp());
$this->assertSame($this->notification, $this->notification->setApp($app));
@@ -71,10 +71,10 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataSetAppInvalid
* @param mixed $app
*
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetAppInvalid')]
public function testSetAppInvalid($app): void {
$this->expectException(\InvalidArgumentException::class);
@@ -87,9 +87,9 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataSetUser
* @param string $user
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetUser')]
public function testSetUser($user): void {
$this->assertSame('', $this->notification->getUser());
$this->assertSame($this->notification, $this->notification->setUser($user));
@@ -101,10 +101,10 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataSetUserInvalid
* @param mixed $user
*
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetUserInvalid')]
public function testSetUserInvalid($user): void {
$this->expectException(\InvalidArgumentException::class);
@@ -126,9 +126,9 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataSetDateTime
* @param \DateTime $dateTime
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetDateTime')]
public function testSetDateTime(\DateTime $dateTime): void {
$this->assertSame(0, $this->notification->getDateTime()->getTimestamp());
$this->assertSame($this->notification, $this->notification->setDateTime($dateTime));
@@ -144,11 +144,10 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataSetDateTimeZero
* @param \DateTime $dateTime
- *
* @expectedMessage 'The given date time is invalid'
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetDateTimeZero')]
public function testSetDateTimeZero($dateTime): void {
$this->expectException(\InvalidArgumentException::class);
@@ -163,10 +162,10 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataSetObject
* @param string $type
* @param string $id
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetObject')]
public function testSetObject($type, $id): void {
$this->assertSame('', $this->notification->getObjectType());
$this->assertSame('', $this->notification->getObjectId());
@@ -187,11 +186,10 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataSetObjectIdInvalid
* @param mixed $id
- *
* @expectedMessage 'The given object id is invalid'
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetObjectIdInvalid')]
public function testSetObjectIdInvalid($id): void {
$this->expectException(\InvalidArgumentException::class);
@@ -207,10 +205,10 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataSetSubject
* @param string $subject
* @param array $parameters
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetSubject')]
public function testSetSubject($subject, $parameters): void {
$this->assertSame('', $this->notification->getSubject());
$this->assertSame([], $this->notification->getSubjectParameters());
@@ -224,10 +222,10 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataSetSubjectInvalidSubject
* @param mixed $subject
*
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetSubjectInvalidSubject')]
public function testSetSubjectInvalidSubject($subject): void {
$this->expectException(\InvalidArgumentException::class);
@@ -239,9 +237,9 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataSetParsedSubject
* @param string $subject
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetParsedSubject')]
public function testSetParsedSubject($subject): void {
$this->assertSame('', $this->notification->getParsedSubject());
$this->assertSame($this->notification, $this->notification->setParsedSubject($subject));
@@ -253,10 +251,10 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataSetParsedSubjectInvalid
* @param mixed $subject
*
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetParsedSubjectInvalid')]
public function testSetParsedSubjectInvalid($subject): void {
$this->expectException(\InvalidArgumentException::class);
@@ -272,10 +270,10 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataSetMessage
* @param string $message
* @param array $parameters
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetMessage')]
public function testSetMessage($message, $parameters): void {
$this->assertSame('', $this->notification->getMessage());
$this->assertSame([], $this->notification->getMessageParameters());
@@ -289,10 +287,10 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataSetMessageInvalidMessage
* @param mixed $message
*
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetMessageInvalidMessage')]
public function testSetMessageInvalidMessage($message): void {
$this->expectException(\InvalidArgumentException::class);
@@ -304,9 +302,9 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataSetParsedMessage
* @param string $message
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetParsedMessage')]
public function testSetParsedMessage($message): void {
$this->assertSame('', $this->notification->getParsedMessage());
$this->assertSame($this->notification, $this->notification->setParsedMessage($message));
@@ -318,10 +316,10 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataSetParsedMessageInvalid
* @param mixed $message
*
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetParsedMessageInvalid')]
public function testSetParsedMessageInvalid($message): void {
$this->expectException(\InvalidArgumentException::class);
@@ -333,9 +331,9 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataSetLink
* @param string $link
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetLink')]
public function testSetLink($link): void {
$this->assertSame('', $this->notification->getLink());
$this->assertSame($this->notification, $this->notification->setLink($link));
@@ -347,10 +345,10 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataSetLinkInvalid
* @param mixed $link
*
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetLinkInvalid')]
public function testSetLinkInvalid($link): void {
$this->expectException(\InvalidArgumentException::class);
@@ -362,9 +360,9 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataSetIcon
* @param string $icon
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetIcon')]
public function testSetIcon($icon): void {
$this->assertSame('', $this->notification->getIcon());
$this->assertSame($this->notification, $this->notification->setIcon($icon));
@@ -376,10 +374,10 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataSetIconInvalid
* @param mixed $icon
*
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetIconInvalid')]
public function testSetIconInvalid($icon): void {
$this->expectException(\InvalidArgumentException::class);
@@ -392,7 +390,7 @@ class NotificationTest extends TestCase {
}
public function testAddAction(): void {
- /** @var \OCP\Notification\IAction|\PHPUnit\Framework\MockObject\MockObject $action */
+ /** @var IAction|\PHPUnit\Framework\MockObject\MockObject $action */
$action = $this->createMock(IAction::class);
$action->expects($this->once())
->method('isValid')
@@ -410,7 +408,7 @@ class NotificationTest extends TestCase {
public function testAddActionInvalid(): void {
$this->expectException(\InvalidArgumentException::class);
- /** @var \OCP\Notification\IAction|\PHPUnit\Framework\MockObject\MockObject $action */
+ /** @var IAction|\PHPUnit\Framework\MockObject\MockObject $action */
$action = $this->createMock(IAction::class);
$action->expects($this->once())
->method('isValid')
@@ -422,7 +420,7 @@ class NotificationTest extends TestCase {
}
public function testAddActionSecondPrimary(): void {
- /** @var \OCP\Notification\IAction|\PHPUnit\Framework\MockObject\MockObject $action */
+ /** @var IAction|\PHPUnit\Framework\MockObject\MockObject $action */
$action = $this->createMock(IAction::class);
$action->expects($this->exactly(2))
->method('isValid')
@@ -438,7 +436,7 @@ class NotificationTest extends TestCase {
}
public function testAddParsedAction(): void {
- /** @var \OCP\Notification\IAction|\PHPUnit\Framework\MockObject\MockObject $action */
+ /** @var IAction|\PHPUnit\Framework\MockObject\MockObject $action */
$action = $this->createMock(IAction::class);
$action->expects($this->once())
->method('isValidParsed')
@@ -456,7 +454,7 @@ class NotificationTest extends TestCase {
public function testAddParsedActionInvalid(): void {
$this->expectException(\InvalidArgumentException::class);
- /** @var \OCP\Notification\IAction|\PHPUnit\Framework\MockObject\MockObject $action */
+ /** @var IAction|\PHPUnit\Framework\MockObject\MockObject $action */
$action = $this->createMock(IAction::class);
$action->expects($this->once())
->method('isValidParsed')
@@ -468,7 +466,7 @@ class NotificationTest extends TestCase {
}
public function testAddActionSecondParsedPrimary(): void {
- /** @var \OCP\Notification\IAction|\PHPUnit\Framework\MockObject\MockObject $action */
+ /** @var IAction|\PHPUnit\Framework\MockObject\MockObject $action */
$action = $this->createMock(IAction::class);
$action->expects($this->exactly(2))
->method('isValidParsed')
@@ -484,7 +482,7 @@ class NotificationTest extends TestCase {
}
public function testAddActionParsedPrimaryEnd(): void {
- /** @var \OCP\Notification\IAction|\PHPUnit\Framework\MockObject\MockObject $action */
+ /** @var IAction|\PHPUnit\Framework\MockObject\MockObject $action */
$action1 = $this->createMock(IAction::class);
$action1->expects($this->exactly(2))
->method('isValidParsed')
@@ -492,7 +490,7 @@ class NotificationTest extends TestCase {
$action1->expects($this->exactly(2))
->method('isPrimary')
->willReturn(false);
- /** @var \OCP\Notification\IAction|\PHPUnit\Framework\MockObject\MockObject $action */
+ /** @var IAction|\PHPUnit\Framework\MockObject\MockObject $action */
$action2 = $this->createMock(IAction::class);
$action2->expects($this->once())
->method('isValidParsed')
@@ -518,14 +516,14 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataIsValid
*
* @param bool $isValidCommon
* @param string $subject
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataIsValid')]
public function testIsValid($isValidCommon, $subject, $expected): void {
- /** @var \OCP\Notification\INotification|\PHPUnit\Framework\MockObject\MockObject $notification */
+ /** @var INotification|\PHPUnit\Framework\MockObject\MockObject $notification */
$notification = $this->getMockBuilder(Notification::class)
->onlyMethods([
'isValidCommon',
@@ -551,14 +549,14 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataIsValid
*
* @param bool $isValidCommon
* @param string $subject
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataIsValid')]
public function testIsParsedValid($isValidCommon, $subject, $expected): void {
- /** @var \OCP\Notification\INotification|\PHPUnit\Framework\MockObject\MockObject $notification */
+ /** @var INotification|\PHPUnit\Framework\MockObject\MockObject $notification */
$notification = $this->getMockBuilder(Notification::class)
->onlyMethods([
'isValidCommon',
@@ -595,7 +593,6 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataIsValidCommon
*
* @param string $app
* @param string $user
@@ -604,8 +601,9 @@ class NotificationTest extends TestCase {
* @param string $objectId
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataIsValidCommon')]
public function testIsValidCommon($app, $user, $timestamp, $objectType, $objectId, $expected): void {
- /** @var \OCP\Notification\INotification|\PHPUnit\Framework\MockObject\MockObject $notification */
+ /** @var INotification|\PHPUnit\Framework\MockObject\MockObject $notification */
$notification = $this->getMockBuilder(Notification::class)
->onlyMethods([
'getApp',
diff --git a/tests/lib/OCS/ApiHelperTest.php b/tests/lib/OCS/ApiHelperTest.php
index 93de6b22af7..334fca7169e 100644
--- a/tests/lib/OCS/ApiHelperTest.php
+++ b/tests/lib/OCS/ApiHelperTest.php
@@ -34,9 +34,7 @@ class ApiHelperTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider versionDataScriptNameProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('versionDataScriptNameProvider')]
public function testIsV2(string $scriptName, bool $expected): void {
$request = $this->getMockBuilder(IRequest::class)
->disableOriginalConstructor()
diff --git a/tests/lib/OCS/DiscoveryServiceTest.php b/tests/lib/OCS/DiscoveryServiceTest.php
index 57b6e5c18e7..422c97f4221 100644
--- a/tests/lib/OCS/DiscoveryServiceTest.php
+++ b/tests/lib/OCS/DiscoveryServiceTest.php
@@ -36,11 +36,11 @@ class DiscoveryServiceTest extends TestCase {
}
/**
- * @dataProvider dataTestIsSafeUrl
*
* @param string $url
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestIsSafeUrl')]
public function testIsSafeUrl($url, $expected): void {
$result = $this->invokePrivate($this->discoveryService, 'isSafeUrl', [$url]);
$this->assertSame($expected, $result);
@@ -59,12 +59,12 @@ class DiscoveryServiceTest extends TestCase {
}
/**
- * @dataProvider dataTestGetEndpoints
*
* @param array $decodedServices
* @param string $service
* @param array $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetEndpoints')]
public function testGetEndpoints($decodedServices, $service, $expected): void {
$result = $this->invokePrivate($this->discoveryService, 'getEndpoints', [$decodedServices, $service]);
$this->assertSame($expected, $result);
diff --git a/tests/lib/OCS/ProviderTest.php b/tests/lib/OCS/ProviderTest.php
index 28808a9d6ba..87e01d8301b 100644
--- a/tests/lib/OCS/ProviderTest.php
+++ b/tests/lib/OCS/ProviderTest.php
@@ -9,12 +9,14 @@
namespace Test\OCS;
use OC\OCS\Provider;
+use OCP\App\IAppManager;
use OCP\AppFramework\Http\JSONResponse;
+use OCP\IRequest;
class ProviderTest extends \Test\TestCase {
- /** @var \OCP\IRequest */
+ /** @var IRequest */
private $request;
- /** @var \OCP\App\IAppManager */
+ /** @var IAppManager */
private $appManager;
/** @var Provider */
private $ocsProvider;
diff --git a/tests/lib/Preview/GeneratorTest.php b/tests/lib/Preview/GeneratorTest.php
index 1e9f82dbf1b..edf5418da6e 100644
--- a/tests/lib/Preview/GeneratorTest.php
+++ b/tests/lib/Preview/GeneratorTest.php
@@ -381,7 +381,6 @@ class GeneratorTest extends \Test\TestCase {
}
/**
- * @dataProvider dataSize
*
* @param int $maxX
* @param int $maxY
@@ -392,6 +391,7 @@ class GeneratorTest extends \Test\TestCase {
* @param int $expectedX
* @param int $expectedY
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSize')]
public function testCorrectSize($maxX, $maxY, $reqX, $reqY, $crop, $mode, $expectedX, $expectedY): void {
$file = $this->createMock(File::class);
$file->method('isReadable')
diff --git a/tests/lib/Preview/Provider.php b/tests/lib/Preview/Provider.php
index daa069483fd..d8f10c430e4 100644
--- a/tests/lib/Preview/Provider.php
+++ b/tests/lib/Preview/Provider.php
@@ -15,6 +15,7 @@ use OC\Files\Storage\Temporary;
use OC\Files\View;
use OC\Preview\TXT;
use OCP\Files\IRootFolder;
+use OCP\IImage;
use OCP\IUserManager;
use OCP\Server;
@@ -71,12 +72,12 @@ abstract class Provider extends \Test\TestCase {
/**
* Launches all the tests we have
*
- * @dataProvider dimensionsDataProvider
* @requires extension imagick
*
* @param int $widthAdjustment
* @param int $heightAdjustment
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dimensionsDataProvider')]
public function testGetThumbnail($widthAdjustment, $heightAdjustment): void {
$ratio = round($this->width / $this->height, 2);
$this->maxWidth = $this->width - $widthAdjustment;
@@ -120,7 +121,7 @@ abstract class Provider extends \Test\TestCase {
*
* @param \OC\Preview\Provider $provider
*
- * @return bool|\OCP\IImage
+ * @return bool|IImage
*/
private function getPreview($provider) {
$file = new File(Server::get(IRootFolder::class), $this->rootView, $this->imgPath);
@@ -139,7 +140,7 @@ abstract class Provider extends \Test\TestCase {
/**
* Checks if the preview ratio matches the original ratio
*
- * @param \OCP\IImage $preview
+ * @param IImage $preview
* @param int $ratio
*/
private function doesRatioMatch($preview, $ratio) {
@@ -150,7 +151,7 @@ abstract class Provider extends \Test\TestCase {
/**
* Tests if a max size preview of smaller dimensions can be created
*
- * @param \OCP\IImage $preview
+ * @param IImage $preview
*/
private function doesPreviewFit($preview) {
$maxDimRatio = round($this->maxWidth / $this->maxHeight, 2);
diff --git a/tests/lib/Preview/SVGTest.php b/tests/lib/Preview/SVGTest.php
index 7612ac37c66..8c6d9bb6691 100644
--- a/tests/lib/Preview/SVGTest.php
+++ b/tests/lib/Preview/SVGTest.php
@@ -46,9 +46,9 @@ class SVGTest extends Provider {
}
/**
- * @dataProvider dataGetThumbnailSVGHref
* @requires extension imagick
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetThumbnailSVGHref')]
public function testGetThumbnailSVGHref(string $content): void {
$handle = fopen('php://temp', 'w+');
fwrite($handle, '<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
diff --git a/tests/lib/Profile/Actions/FediverseActionTest.php b/tests/lib/Profile/Actions/FediverseActionTest.php
index c0e2e6e6309..7f4c7d96301 100644
--- a/tests/lib/Profile/Actions/FediverseActionTest.php
+++ b/tests/lib/Profile/Actions/FediverseActionTest.php
@@ -105,7 +105,7 @@ class FediverseActionTest extends TestCase {
];
}
- /** @dataProvider dataGetTitle */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetTitle')]
public function testGetTitle(string $value): void {
$property = $this->createMock(IAccountProperty::class);
$property->method('getValue')
@@ -154,7 +154,7 @@ class FediverseActionTest extends TestCase {
];
}
- /** @dataProvider dataGetTarget */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetTarget')]
public function testGetTarget(?string $value, ?string $expected): void {
$user = $this->createMock(IUser::class);
diff --git a/tests/lib/Repair/ClearGeneratedAvatarCacheTest.php b/tests/lib/Repair/ClearGeneratedAvatarCacheTest.php
index d80f09fc676..43203d489e6 100644
--- a/tests/lib/Repair/ClearGeneratedAvatarCacheTest.php
+++ b/tests/lib/Repair/ClearGeneratedAvatarCacheTest.php
@@ -45,11 +45,11 @@ class ClearGeneratedAvatarCacheTest extends \Test\TestCase {
}
/**
- * @dataProvider shouldRunDataProvider
*
* @param string $from
* @param boolean $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('shouldRunDataProvider')]
public function testShouldRun($from, $expected): void {
$this->config->expects($this->any())
->method('getSystemValueString')
diff --git a/tests/lib/Repair/RepairInvalidSharesTest.php b/tests/lib/Repair/RepairInvalidSharesTest.php
index 7a9b4de03e4..72103976da5 100644
--- a/tests/lib/Repair/RepairInvalidSharesTest.php
+++ b/tests/lib/Repair/RepairInvalidSharesTest.php
@@ -150,9 +150,8 @@ class RepairInvalidSharesTest extends TestCase {
/**
* Test adjusting file share permissions
- *
- * @dataProvider fileSharePermissionsProvider
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('fileSharePermissionsProvider')]
public function testFileSharePermissions($itemType, $testPerms, $expectedPerms): void {
$qb = $this->connection->getQueryBuilder();
$qb->insert('share')
diff --git a/tests/lib/RichObjectStrings/DefinitionsTest.php b/tests/lib/RichObjectStrings/DefinitionsTest.php
index 3b1db8fdc74..60ea820e844 100644
--- a/tests/lib/RichObjectStrings/DefinitionsTest.php
+++ b/tests/lib/RichObjectStrings/DefinitionsTest.php
@@ -31,10 +31,10 @@ class DefinitionsTest extends TestCase {
}
/**
- * @dataProvider dataGetDefinition
* @param string $type
* @param array $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetDefinition')]
public function testGetDefinition($type, array $expected): void {
$definitions = new Definitions();
$definition = $definitions->getDefinition($type);
diff --git a/tests/lib/RichObjectStrings/ValidatorTest.php b/tests/lib/RichObjectStrings/ValidatorTest.php
index c5f88394a33..26688d3401a 100644
--- a/tests/lib/RichObjectStrings/ValidatorTest.php
+++ b/tests/lib/RichObjectStrings/ValidatorTest.php
@@ -80,9 +80,7 @@ class ValidatorTest extends TestCase {
];
}
- /**
- * @dataProvider dataValidateParameterKeys
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataValidateParameterKeys')]
public function testValidateParameterKeys(mixed $key, ?string $throws): void {
if ($throws !== null) {
diff --git a/tests/lib/Security/Bruteforce/Backend/MemoryCacheBackendTest.php b/tests/lib/Security/Bruteforce/Backend/MemoryCacheBackendTest.php
index ac679238617..e0289fa7ca9 100644
--- a/tests/lib/Security/Bruteforce/Backend/MemoryCacheBackendTest.php
+++ b/tests/lib/Security/Bruteforce/Backend/MemoryCacheBackendTest.php
@@ -67,9 +67,7 @@ class MemoryCacheBackendTest extends TestCase {
];
}
- /**
- * @dataProvider dataGetAttempts
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetAttempts')]
public function testGetAttempts(int $maxAge, ?string $action, ?array $metadata, int $expected): void {
$this->cache
->expects($this->once())
diff --git a/tests/lib/Security/CSRF/CsrfTokenGeneratorTest.php b/tests/lib/Security/CSRF/CsrfTokenGeneratorTest.php
index e40726fe56a..86f458d8ea8 100644
--- a/tests/lib/Security/CSRF/CsrfTokenGeneratorTest.php
+++ b/tests/lib/Security/CSRF/CsrfTokenGeneratorTest.php
@@ -11,9 +11,10 @@ declare(strict_types=1);
namespace Test\Security\CSRF;
use OC\Security\CSRF\CsrfTokenGenerator;
+use OCP\Security\ISecureRandom;
class CsrfTokenGeneratorTest extends \Test\TestCase {
- /** @var \OCP\Security\ISecureRandom */
+ /** @var ISecureRandom */
private $random;
/** @var \OC\Security\CSRF\CsrfTokenGenerator */
private $csrfTokenGenerator;
diff --git a/tests/lib/Security/CSRF/TokenStorage/SessionStorageTest.php b/tests/lib/Security/CSRF/TokenStorage/SessionStorageTest.php
index 0e8a36112e2..2b2c4af0444 100644
--- a/tests/lib/Security/CSRF/TokenStorage/SessionStorageTest.php
+++ b/tests/lib/Security/CSRF/TokenStorage/SessionStorageTest.php
@@ -14,7 +14,7 @@ use OC\Security\CSRF\TokenStorage\SessionStorage;
use OCP\ISession;
class SessionStorageTest extends \Test\TestCase {
- /** @var \OCP\ISession */
+ /** @var ISession */
private $session;
/** @var \OC\Security\CSRF\TokenStorage\SessionStorage */
private $sessionStorage;
@@ -42,9 +42,9 @@ class SessionStorageTest extends \Test\TestCase {
/**
* @param string $token
- * @dataProvider getTokenDataProvider
*
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('getTokenDataProvider')]
public function testGetTokenWithEmptyToken($token): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Session does not contain a requesttoken');
diff --git a/tests/lib/Security/CertificateManagerTest.php b/tests/lib/Security/CertificateManagerTest.php
index 3657eeb2f99..4dadc824ef6 100644
--- a/tests/lib/Security/CertificateManagerTest.php
+++ b/tests/lib/Security/CertificateManagerTest.php
@@ -114,9 +114,9 @@ class CertificateManagerTest extends \Test\TestCase {
}
/**
- * @dataProvider dangerousFileProvider
* @param string $filename
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dangerousFileProvider')]
public function testAddDangerousFile($filename): void {
$this->expectException(InvalidPathException::class);
$this->certificateManager->addCertificate(file_get_contents(__DIR__ . '/../../data/certificates/expiredCertificate.crt'), $filename);
@@ -136,13 +136,13 @@ class CertificateManagerTest extends \Test\TestCase {
}
/**
- * @dataProvider dataTestNeedRebundling
*
* @param int $CaBundleMtime
* @param int $targetBundleMtime
* @param int $targetBundleExists
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestNeedRebundling')]
public function testNeedRebundling($CaBundleMtime,
$targetBundleMtime,
$targetBundleExists,
diff --git a/tests/lib/Security/CredentialsManagerTest.php b/tests/lib/Security/CredentialsManagerTest.php
index d5e7a114667..4dfe8c5681d 100644
--- a/tests/lib/Security/CredentialsManagerTest.php
+++ b/tests/lib/Security/CredentialsManagerTest.php
@@ -17,9 +17,7 @@ use OCP\Server;
* @group DB
*/
class CredentialsManagerTest extends \Test\TestCase {
- /**
- * @dataProvider credentialsProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('credentialsProvider')]
public function testWithDB($userId, $identifier): void {
$credentialsManager = Server::get(ICredentialsManager::class);
@@ -34,9 +32,7 @@ class CredentialsManagerTest extends \Test\TestCase {
$this->assertSame(1, $removedRows);
}
- /**
- * @dataProvider credentialsProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('credentialsProvider')]
public function testUpdate($userId, $identifier): void {
$credentialsManager = Server::get(ICredentialsManager::class);
diff --git a/tests/lib/Security/CryptoTest.php b/tests/lib/Security/CryptoTest.php
index b650e3ffc09..0f8575ab0b5 100644
--- a/tests/lib/Security/CryptoTest.php
+++ b/tests/lib/Security/CryptoTest.php
@@ -31,9 +31,7 @@ class CryptoTest extends \Test\TestCase {
$this->crypto = new Crypto(Server::get(IConfig::class));
}
- /**
- * @dataProvider defaultEncryptionProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('defaultEncryptionProvider')]
public function testDefaultEncrypt($stringToEncrypt): void {
$ciphertext = $this->crypto->encrypt($stringToEncrypt);
$this->assertEquals($stringToEncrypt, $this->crypto->decrypt($ciphertext));
diff --git a/tests/lib/Security/HasherTest.php b/tests/lib/Security/HasherTest.php
index 11b63e8ec88..33130f86a73 100644
--- a/tests/lib/Security/HasherTest.php
+++ b/tests/lib/Security/HasherTest.php
@@ -124,18 +124,14 @@ class HasherTest extends \Test\TestCase {
$this->assertNotNull($hash);
}
- /**
- * @dataProvider versionHashProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('versionHashProvider')]
public function testSplitHash($hash, $expected): void {
$relativePath = self::invokePrivate($this->hasher, 'splitHash', [$hash]);
$this->assertSame($expected, $relativePath);
}
- /**
- * @dataProvider hashProviders70_71
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('hashProviders70_71')]
public function testVerify($password, $hash, $expected): void {
$this->config
->expects($this->any())
@@ -151,9 +147,7 @@ class HasherTest extends \Test\TestCase {
$this->assertSame($expected, $result);
}
- /**
- * @dataProvider hashProviders72
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('hashProviders72')]
public function testVerifyArgon2i($password, $hash, $expected): void {
if (!\defined('PASSWORD_ARGON2I')) {
$this->markTestSkipped('Need ARGON2 support to test ARGON2 hashes');
@@ -163,9 +157,7 @@ class HasherTest extends \Test\TestCase {
$this->assertSame($expected, $result);
}
- /**
- * @dataProvider hashProviders73
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('hashProviders73')]
public function testVerifyArgon2id(string $password, string $hash, bool $expected): void {
if (!\defined('PASSWORD_ARGON2ID')) {
$this->markTestSkipped('Need ARGON2ID support to test ARGON2ID hashes');
diff --git a/tests/lib/Security/Ip/BruteforceAllowListTest.php b/tests/lib/Security/Ip/BruteforceAllowListTest.php
index efdb7c4034c..0cffc128d64 100644
--- a/tests/lib/Security/Ip/BruteforceAllowListTest.php
+++ b/tests/lib/Security/Ip/BruteforceAllowListTest.php
@@ -130,10 +130,9 @@ class BruteforceAllowListTest extends TestCase {
}
/**
- * @dataProvider dataIsBypassListed
- *
* @param string[] $allowList
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataIsBypassListed')]
public function testIsBypassListed(
string $ip,
array $allowList,
diff --git a/tests/lib/Security/Ip/RemoteAddressTest.php b/tests/lib/Security/Ip/RemoteAddressTest.php
index 63c1b452294..a6619cffe8e 100644
--- a/tests/lib/Security/Ip/RemoteAddressTest.php
+++ b/tests/lib/Security/Ip/RemoteAddressTest.php
@@ -25,8 +25,8 @@ class RemoteAddressTest extends \Test\TestCase {
/**
* @param mixed $allowedRanges
- * @dataProvider dataProvider
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataProvider')]
public function testAllowedIps(string $remoteIp, $allowedRanges, bool $expected): void {
$this->request
->method('getRemoteAddress')
diff --git a/tests/lib/Security/Normalizer/IpAddressTest.php b/tests/lib/Security/Normalizer/IpAddressTest.php
index 29067596c98..f7adfb4a0dd 100644
--- a/tests/lib/Security/Normalizer/IpAddressTest.php
+++ b/tests/lib/Security/Normalizer/IpAddressTest.php
@@ -55,11 +55,11 @@ class IpAddressTest extends TestCase {
}
/**
- * @dataProvider subnetDataProvider
*
* @param string $input
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('subnetDataProvider')]
public function testGetSubnet($input, $expected): void {
$this->assertSame($expected, (new IpAddress($input))->getSubnet());
}
diff --git a/tests/lib/Security/RemoteHostValidatorIntegrationTest.php b/tests/lib/Security/RemoteHostValidatorIntegrationTest.php
index 3d319e828ff..913acfa054d 100644
--- a/tests/lib/Security/RemoteHostValidatorIntegrationTest.php
+++ b/tests/lib/Security/RemoteHostValidatorIntegrationTest.php
@@ -73,9 +73,7 @@ class RemoteHostValidatorIntegrationTest extends TestCase {
];
}
- /**
- * @dataProvider localHostsData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('localHostsData')]
public function testLocalHostsWhenNotAllowed(string $host): void {
$this->config
->method('getSystemValueBool')
@@ -87,9 +85,7 @@ class RemoteHostValidatorIntegrationTest extends TestCase {
self::assertFalse($isValid);
}
- /**
- * @dataProvider localHostsData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('localHostsData')]
public function testLocalHostsWhenAllowed(string $host): void {
$this->config
->method('getSystemValueBool')
@@ -111,9 +107,7 @@ class RemoteHostValidatorIntegrationTest extends TestCase {
];
}
- /**
- * @dataProvider externalAddressesData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('externalAddressesData')]
public function testExternalHost(string $host): void {
$this->config
->method('getSystemValueBool')
diff --git a/tests/lib/Security/RemoteHostValidatorTest.php b/tests/lib/Security/RemoteHostValidatorTest.php
index 46c969d28c1..b048b9dafd1 100644
--- a/tests/lib/Security/RemoteHostValidatorTest.php
+++ b/tests/lib/Security/RemoteHostValidatorTest.php
@@ -51,9 +51,7 @@ class RemoteHostValidatorTest extends TestCase {
];
}
- /**
- * @dataProvider dataValid
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataValid')]
public function testValid(string $host, bool $expected): void {
$this->hostnameClassifier
->method('isLocalHostname')
diff --git a/tests/lib/Security/SecureRandomTest.php b/tests/lib/Security/SecureRandomTest.php
index 490045a4c52..954fd85eaf1 100644
--- a/tests/lib/Security/SecureRandomTest.php
+++ b/tests/lib/Security/SecureRandomTest.php
@@ -40,34 +40,26 @@ class SecureRandomTest extends \Test\TestCase {
$this->rng = new SecureRandom();
}
- /**
- * @dataProvider stringGenerationProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('stringGenerationProvider')]
public function testGetLowStrengthGeneratorLength($length, $expectedLength): void {
$generator = $this->rng;
$this->assertEquals($expectedLength, strlen($generator->generate($length)));
}
- /**
- * @dataProvider stringGenerationProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('stringGenerationProvider')]
public function testMediumLowStrengthGeneratorLength($length, $expectedLength): void {
$generator = $this->rng;
$this->assertEquals($expectedLength, strlen($generator->generate($length)));
}
- /**
- * @dataProvider stringGenerationProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('stringGenerationProvider')]
public function testUninitializedGenerate($length, $expectedLength): void {
$this->assertEquals($expectedLength, strlen($this->rng->generate($length)));
}
- /**
- * @dataProvider charCombinations
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('charCombinations')]
public function testScheme($charName, $chars): void {
$generator = $this->rng;
$scheme = constant('OCP\Security\ISecureRandom::' . $charName);
@@ -83,9 +75,7 @@ class SecureRandomTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider invalidLengths
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('invalidLengths')]
public function testInvalidLengths($length): void {
$this->expectException(\LengthException::class);
$generator = $this->rng;
diff --git a/tests/lib/Security/TrustedDomainHelperTest.php b/tests/lib/Security/TrustedDomainHelperTest.php
index 1b9ba20a906..8b671a93d06 100644
--- a/tests/lib/Security/TrustedDomainHelperTest.php
+++ b/tests/lib/Security/TrustedDomainHelperTest.php
@@ -27,11 +27,11 @@ class TrustedDomainHelperTest extends \Test\TestCase {
}
/**
- * @dataProvider trustedDomainDataProvider
* @param string $trustedDomains
* @param string $testDomain
* @param bool $result
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('trustedDomainDataProvider')]
public function testIsTrustedUrl($trustedDomains, $testDomain, $result): void {
$this->config->method('getSystemValue')
->willReturnMap([
@@ -44,11 +44,11 @@ class TrustedDomainHelperTest extends \Test\TestCase {
}
/**
- * @dataProvider trustedDomainDataProvider
* @param string $trustedDomains
* @param string $testDomain
* @param bool $result
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('trustedDomainDataProvider')]
public function testIsTrustedDomain($trustedDomains, $testDomain, $result): void {
$this->config->method('getSystemValue')
->willReturnMap([
diff --git a/tests/lib/ServerTest.php b/tests/lib/ServerTest.php
index 1dd4ba6c1ea..b070641e856 100644
--- a/tests/lib/ServerTest.php
+++ b/tests/lib/ServerTest.php
@@ -21,7 +21,7 @@ use OCP\Comments\ICommentsManager;
* @package Test
*/
class ServerTest extends \Test\TestCase {
- /** @var \OC\Server */
+ /** @var Server */
protected $server;
@@ -44,11 +44,11 @@ class ServerTest extends \Test\TestCase {
}
/**
- * @dataProvider dataTestQuery
*
* @param string $serviceName
* @param string $instanceOf
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestQuery')]
public function testQuery($serviceName, $instanceOf): void {
$this->assertInstanceOf($instanceOf, $this->server->query($serviceName), 'Service "' . $serviceName . '"" did not return the right class');
}
diff --git a/tests/lib/Session/CryptoSessionDataTest.php b/tests/lib/Session/CryptoSessionDataTest.php
index e532b2128a6..a30a3297094 100644
--- a/tests/lib/Session/CryptoSessionDataTest.php
+++ b/tests/lib/Session/CryptoSessionDataTest.php
@@ -10,13 +10,14 @@ namespace Test\Session;
use OC\Session\CryptoSessionData;
use OC\Session\Memory;
+use OCP\ISession;
use OCP\Security\ICrypto;
class CryptoSessionDataTest extends Session {
- /** @var \PHPUnit\Framework\MockObject\MockObject|\OCP\Security\ICrypto */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|ICrypto */
protected $crypto;
- /** @var \OCP\ISession */
+ /** @var ISession */
protected $wrappedSession;
protected function setUp(): void {
diff --git a/tests/lib/Session/CryptoWrappingTest.php b/tests/lib/Session/CryptoWrappingTest.php
index 33a6069285f..2bc09e0903a 100644
--- a/tests/lib/Session/CryptoWrappingTest.php
+++ b/tests/lib/Session/CryptoWrappingTest.php
@@ -10,13 +10,14 @@ namespace Test\Session;
use OC\Session\CryptoSessionData;
use OCP\ISession;
+use OCP\Security\ICrypto;
use Test\TestCase;
class CryptoWrappingTest extends TestCase {
- /** @var \PHPUnit\Framework\MockObject\MockObject|\OCP\Security\ICrypto */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|ICrypto */
protected $crypto;
- /** @var \PHPUnit\Framework\MockObject\MockObject|\OCP\ISession */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|ISession */
protected $wrappedSession;
/** @var \OC\Session\CryptoSessionData */
diff --git a/tests/lib/Settings/DeclarativeManagerTest.php b/tests/lib/Settings/DeclarativeManagerTest.php
index d279dfa46f0..59411e1f825 100644
--- a/tests/lib/Settings/DeclarativeManagerTest.php
+++ b/tests/lib/Settings/DeclarativeManagerTest.php
@@ -345,9 +345,7 @@ class DeclarativeManagerTest extends TestCase {
$this->assertFalse(isset($formIds[$app]) && in_array($schemaDuplicateFields['id'], $formIds[$app]));
}
- /**
- * @dataProvider dataValidateSchema
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataValidateSchema')]
public function testValidateSchema(bool $expected, bool $expectException, string $app, array $schema): void {
if ($expectException) {
$this->expectException(\Exception::class);
diff --git a/tests/lib/SetupCheck/CheckServerResponseTraitTest.php b/tests/lib/SetupCheck/CheckServerResponseTraitTest.php
index 72392aab4c8..3f7b498bfeb 100644
--- a/tests/lib/SetupCheck/CheckServerResponseTraitTest.php
+++ b/tests/lib/SetupCheck/CheckServerResponseTraitTest.php
@@ -48,9 +48,7 @@ class CheckServerResponseTraitTest extends TestCase {
);
}
- /**
- * @dataProvider dataNormalizeUrl
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataNormalizeUrl')]
public function testNormalizeUrl(string $url, bool $isRootRequest, string $expected): void {
$this->assertEquals($expected, $this->trait->normalizeUrl($url, $isRootRequest));
}
@@ -75,9 +73,7 @@ class CheckServerResponseTraitTest extends TestCase {
];
}
- /**
- * @dataProvider dataGetTestUrls
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetTestUrls')]
public function testGetTestUrls(
string $url,
bool $isRootRequest,
diff --git a/tests/lib/SetupTest.php b/tests/lib/SetupTest.php
index a01dfa60ddc..0be7eab36f6 100644
--- a/tests/lib/SetupTest.php
+++ b/tests/lib/SetupTest.php
@@ -129,10 +129,10 @@ class SetupTest extends \Test\TestCase {
}
/**
- * @dataProvider findWebRootProvider
* @param $url
* @param $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('findWebRootProvider')]
public function testFindWebRootCli($url, $expected): void {
$cliState = \OC::$CLI;
diff --git a/tests/lib/Share/HelperTest.php b/tests/lib/Share/HelperTest.php
index 3375545c033..3438f108749 100644
--- a/tests/lib/Share/HelperTest.php
+++ b/tests/lib/Share/HelperTest.php
@@ -36,21 +36,19 @@ class HelperTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider expireDateProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('expireDateProvider')]
public function testCalculateExpireDate($defaultExpireSettings, $creationTime, $userExpireDate, $expected): void {
$result = Helper::calculateExpireDate($defaultExpireSettings, $creationTime, $userExpireDate);
$this->assertSame($expected, $result);
}
/**
- * @dataProvider dataTestCompareServerAddresses
*
* @param string $server1
* @param string $server2
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestCompareServerAddresses')]
public function testIsSameUserOnSameServer($user1, $server1, $user2, $server2, $expected): void {
$this->assertSame($expected,
Helper::isSameUserOnSameServer($user1, $server1, $user2, $server2)
diff --git a/tests/lib/Share/ShareTest.php b/tests/lib/Share/ShareTest.php
index b30400fbda7..9690d242067 100644
--- a/tests/lib/Share/ShareTest.php
+++ b/tests/lib/Share/ShareTest.php
@@ -127,10 +127,10 @@ class ShareTest extends \Test\TestCase {
}
/**
- * @dataProvider urls
* @param string $url
* @param string $expectedResult
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('urls')]
public function testRemoveProtocolFromUrl($url, $expectedResult): void {
$share = new Share();
$result = self::invokePrivate($share, 'removeProtocolFromUrl', [$url]);
@@ -146,10 +146,10 @@ class ShareTest extends \Test\TestCase {
}
/**
- * @dataProvider dataProviderTestGroupItems
* @param array $ungrouped
* @param array $grouped
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataProviderTestGroupItems')]
public function testGroupItems($ungrouped, $grouped): void {
$result = DummyShareClass::groupItemsTest($ungrouped);
diff --git a/tests/lib/Share20/DefaultShareProviderTest.php b/tests/lib/Share20/DefaultShareProviderTest.php
index bed7920cfd6..eaf17fa1a26 100644
--- a/tests/lib/Share20/DefaultShareProviderTest.php
+++ b/tests/lib/Share20/DefaultShareProviderTest.php
@@ -985,9 +985,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider storageAndFileNameProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('storageAndFileNameProvider')]
public function testGetSharedWithUser($storageStringId, $fileName1, $fileName2): void {
$storageId = $this->createTestStorageEntry($storageStringId);
$fileId = $this->createTestFileEntry($fileName1, $storageId);
@@ -1036,9 +1034,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertEquals(IShare::TYPE_USER, $share->getShareType());
}
- /**
- * @dataProvider storageAndFileNameProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('storageAndFileNameProvider')]
public function testGetSharedWithGroup($storageStringId, $fileName1, $fileName2): void {
$storageId = $this->createTestStorageEntry($storageStringId);
$fileId = $this->createTestFileEntry($fileName1, $storageId);
@@ -1110,9 +1106,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertEquals(IShare::TYPE_GROUP, $share->getShareType());
}
- /**
- * @dataProvider storageAndFileNameProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('storageAndFileNameProvider')]
public function testGetSharedWithGroupUserModified($storageStringId, $fileName1, $fileName2): void {
$storageId = $this->createTestStorageEntry($storageStringId);
$fileId = $this->createTestFileEntry($fileName1, $storageId);
@@ -1202,9 +1196,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertSame('userTarget', $share->getTarget());
}
- /**
- * @dataProvider storageAndFileNameProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('storageAndFileNameProvider')]
public function testGetSharedWithUserWithNode($storageStringId, $fileName1, $fileName2): void {
$storageId = $this->createTestStorageEntry($storageStringId);
$fileId = $this->createTestFileEntry($fileName1, $storageId);
@@ -1244,9 +1236,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertEquals(IShare::TYPE_USER, $share->getShareType());
}
- /**
- * @dataProvider storageAndFileNameProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('storageAndFileNameProvider')]
public function testGetSharedWithGroupWithNode($storageStringId, $fileName1, $fileName2): void {
$storageId = $this->createTestStorageEntry($storageStringId);
$fileId = $this->createTestFileEntry($fileName1, $storageId);
@@ -1296,9 +1286,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider shareTypesProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('shareTypesProvider')]
public function testGetSharedWithWithDeletedFile($shareType, $trashed): void {
if ($trashed) {
// exists in database but is in trash
@@ -2302,7 +2290,6 @@ class DefaultShareProviderTest extends \Test\TestCase {
}
/**
- * @dataProvider dataDeleteUser
*
* @param int $type The shareType (user/group/link)
* @param string $owner The owner of the share (uid)
@@ -2311,6 +2298,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
* @param string $deletedUser The user that is deleted
* @param bool $rowDeleted Is the row deleted in this setup
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataDeleteUser')]
public function testDeleteUser($type, $owner, $initiator, $recipient, $deletedUser, $rowDeleted): void {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
@@ -2350,7 +2338,6 @@ class DefaultShareProviderTest extends \Test\TestCase {
}
/**
- * @dataProvider dataDeleteUserGroup
*
* @param string $owner The owner of the share (uid)
* @param string $initiator The initiator of the share (uid)
@@ -2359,6 +2346,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
* @param bool $groupShareDeleted
* @param bool $userGroupShareDeleted
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataDeleteUserGroup')]
public function testDeleteUserGroup($owner, $initiator, $recipient, $deletedUser, $groupShareDeleted, $userGroupShareDeleted): void {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
@@ -2456,12 +2444,12 @@ class DefaultShareProviderTest extends \Test\TestCase {
}
/**
- * @dataProvider dataGroupDeleted
*
* @param $shares
* @param $groupToDelete
* @param $shouldBeDeleted
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGroupDeleted')]
public function testGroupDeleted($shares, $groupToDelete, $shouldBeDeleted): void {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
@@ -2516,12 +2504,12 @@ class DefaultShareProviderTest extends \Test\TestCase {
* And a user specific group share with 'user1'.
* User $user is deleted from group $gid.
*
- * @dataProvider dataUserDeletedFromGroup
*
* @param string $group
* @param string $user
* @param bool $toDelete
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataUserDeletedFromGroup')]
public function testUserDeletedFromGroup($group, $user, $toDelete): void {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php
index 92fa0f3854a..7859407651f 100644
--- a/tests/lib/Share20/ManagerTest.php
+++ b/tests/lib/Share20/ManagerTest.php
@@ -245,9 +245,7 @@ class ManagerTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider dataTestDelete
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestDelete')]
public function testDelete($shareType, $sharedWith): void {
$manager = $this->createManagerMock()
->onlyMethods(['getShareById', 'deleteChildren', 'promoteReshares'])
@@ -1000,12 +998,12 @@ class ManagerTest extends \Test\TestCase {
}
/**
- * @dataProvider dataGeneralChecks
*
* @param $share
* @param $exceptionMessage
* @param $exception
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGeneralChecks')]
public function testGeneralChecks($share, $exceptionMessage, $exception): void {
$thrown = null;
@@ -1076,9 +1074,7 @@ class ManagerTest extends \Test\TestCase {
return [[IShare::TYPE_USER], [IShare::TYPE_REMOTE], [IShare::TYPE_REMOTE_GROUP]];
}
- /**
- * @dataProvider validateExpirationDateInternalProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('validateExpirationDateInternalProvider')]
public function testValidateExpirationDateInternalInPast($shareType): void {
$this->expectException(GenericShareException::class);
$this->expectExceptionMessage('Expiration date is in the past');
@@ -1094,9 +1090,7 @@ class ManagerTest extends \Test\TestCase {
self::invokePrivate($this->manager, 'validateExpirationDateInternal', [$share]);
}
- /**
- * @dataProvider validateExpirationDateInternalProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('validateExpirationDateInternalProvider')]
public function testValidateExpirationDateInternalEnforceButNotSet($shareType): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Expiration date is enforced');
@@ -1121,9 +1115,7 @@ class ManagerTest extends \Test\TestCase {
self::invokePrivate($this->manager, 'validateExpirationDateInternal', [$share]);
}
- /**
- * @dataProvider validateExpirationDateInternalProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('validateExpirationDateInternalProvider')]
public function testValidateExpirationDateInternalEnforceButNotEnabledAndNotSet($shareType): void {
$share = $this->manager->newShare();
$share->setProviderId('foo')->setId('bar');
@@ -1146,9 +1138,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertNull($share->getExpirationDate());
}
- /**
- * @dataProvider validateExpirationDateInternalProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('validateExpirationDateInternalProvider')]
public function testValidateExpirationDateInternalEnforceButNotSetNewShare($shareType): void {
$share = $this->manager->newShare();
$share->setShareType($shareType);
@@ -1181,9 +1171,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertEquals($expected, $share->getExpirationDate());
}
- /**
- * @dataProvider validateExpirationDateInternalProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('validateExpirationDateInternalProvider')]
public function testValidateExpirationDateInternalEnforceRelaxedDefaultButNotSetNewShare($shareType): void {
$share = $this->manager->newShare();
$share->setShareType($shareType);
@@ -1216,9 +1204,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertEquals($expected, $share->getExpirationDate());
}
- /**
- * @dataProvider validateExpirationDateInternalProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('validateExpirationDateInternalProvider')]
public function testValidateExpirationDateInternalEnforceTooFarIntoFuture($shareType): void {
$this->expectException(GenericShareException::class);
$this->expectExceptionMessage('Cannot set expiration date more than 3 days in the future');
@@ -1249,9 +1235,7 @@ class ManagerTest extends \Test\TestCase {
self::invokePrivate($this->manager, 'validateExpirationDateInternal', [$share]);
}
- /**
- * @dataProvider validateExpirationDateInternalProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('validateExpirationDateInternalProvider')]
public function testValidateExpirationDateInternalEnforceValid($shareType): void {
$future = new \DateTime('now', $this->dateTimeZone->getTimeZone());
$future->add(new \DateInterval('P2D'));
@@ -1291,9 +1275,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertEquals($expected, $share->getExpirationDate());
}
- /**
- * @dataProvider validateExpirationDateInternalProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('validateExpirationDateInternalProvider')]
public function testValidateExpirationDateInternalNoDefault($shareType): void {
$date = new \DateTime('now', $this->dateTimeZone->getTimeZone());
$date->add(new \DateInterval('P5D'));
@@ -1317,9 +1299,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertEquals($expected, $share->getExpirationDate());
}
- /**
- * @dataProvider validateExpirationDateInternalProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('validateExpirationDateInternalProvider')]
public function testValidateExpirationDateInternalNoDateNoDefault($shareType): void {
$hookListener = $this->createMock(DummyShareManagerListener::class);
Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListener, 'listener');
@@ -1336,9 +1316,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertNull($share->getExpirationDate());
}
- /**
- * @dataProvider validateExpirationDateInternalProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('validateExpirationDateInternalProvider')]
public function testValidateExpirationDateInternalNoDateDefault($shareType): void {
$share = $this->manager->newShare();
$share->setShareType($shareType);
@@ -1375,9 +1353,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertEquals($expected, $share->getExpirationDate());
}
- /**
- * @dataProvider validateExpirationDateInternalProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('validateExpirationDateInternalProvider')]
public function testValidateExpirationDateInternalDefault($shareType): void {
$future = new \DateTime('now', $this->timezone);
$future->add(new \DateInterval('P5D'));
@@ -1417,9 +1393,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertEquals($expected, $share->getExpirationDate());
}
- /**
- * @dataProvider validateExpirationDateInternalProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('validateExpirationDateInternalProvider')]
public function testValidateExpirationDateInternalHookModification($shareType): void {
$nextWeek = new \DateTime('now', $this->timezone);
$nextWeek->add(new \DateInterval('P7D'));
@@ -1443,9 +1417,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertEquals($save, $share->getExpirationDate());
}
- /**
- * @dataProvider validateExpirationDateInternalProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('validateExpirationDateInternalProvider')]
public function testValidateExpirationDateInternalHookException($shareType): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Invalid date!');
@@ -1468,9 +1440,7 @@ class ManagerTest extends \Test\TestCase {
self::invokePrivate($this->manager, 'validateExpirationDateInternal', [$share]);
}
- /**
- * @dataProvider validateExpirationDateInternalProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('validateExpirationDateInternalProvider')]
public function testValidateExpirationDateInternalExistingShareNoDefault($shareType): void {
$share = $this->manager->newShare();
$share->setShareType($shareType);
@@ -2356,7 +2326,6 @@ class ManagerTest extends \Test\TestCase {
}
/**
- * @dataProvider dataIsSharingDisabledForUser
*
* @param string $excludeGroups
* @param string $groupList
@@ -2364,6 +2333,7 @@ class ManagerTest extends \Test\TestCase {
* @param string[] $groupIds
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataIsSharingDisabledForUser')]
public function testIsSharingDisabledForUser($excludeGroups, $groupList, $setList, $groupIds, $expected): void {
$user = $this->createMock(IUser::class);
@@ -2408,12 +2378,12 @@ class ManagerTest extends \Test\TestCase {
}
/**
- * @dataProvider dataCanShare
*
* @param bool $expected
* @param string $sharingEnabled
* @param bool $disabledForUser
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataCanShare')]
public function testCanShare($expected, $sharingEnabled, $disabledForUser): void {
$this->config->method('getAppValue')
->willReturnMap([
@@ -2960,7 +2930,7 @@ class ManagerTest extends \Test\TestCase {
->onlyMethods(['deleteShare'])
->getMock();
- /** @var \OCP\Share\IShare[] $shares */
+ /** @var IShare[] $shares */
$shares = [];
/*
@@ -2983,7 +2953,7 @@ class ManagerTest extends \Test\TestCase {
$shares[4]->setExpirationDate($today);
$shares[5]->setExpirationDate($today);
- /** @var \OCP\Share\IShare[] $i */
+ /** @var IShare[] $i */
$shares2 = [];
for ($i = 0; $i < 8; $i++) {
$shares2[] = clone $shares[$i];
@@ -4476,9 +4446,7 @@ class ManagerTest extends \Test\TestCase {
$this->addToAssertionCount(1);
}
- /**
- * @dataProvider dataTestShareProviderExists
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestShareProviderExists')]
public function testShareProviderExists($shareType, $expected): void {
$factory = $this->getMockBuilder('OCP\Share\IProviderFactory')->getMock();
$factory->expects($this->any())->method('getProviderForType')
@@ -4849,9 +4817,9 @@ class ManagerTest extends \Test\TestCase {
}
/**
- * @dataProvider dataCurrentUserCanEnumerateTargetUser
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataCurrentUserCanEnumerateTargetUser')]
public function testCurrentUserCanEnumerateTargetUser(bool $currentUserIsGuest, bool $allowEnumerationFullMatch, bool $allowEnumeration, bool $limitEnumerationToPhone, bool $limitEnumerationToGroups, bool $isKnownToUser, bool $haveCommonGroup, bool $expected): void {
/** @var IManager|MockObject $manager */
$manager = $this->createManagerMock()
diff --git a/tests/lib/Share20/ShareHelperTest.php b/tests/lib/Share20/ShareHelperTest.php
index 727ca63fa56..3928843cf7d 100644
--- a/tests/lib/Share20/ShareHelperTest.php
+++ b/tests/lib/Share20/ShareHelperTest.php
@@ -49,9 +49,7 @@ class ShareHelperTest extends TestCase {
];
}
- /**
- * @dataProvider dataGetPathsForAccessList
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetPathsForAccessList')]
public function testGetPathsForAccessList(array $userList, array $userMap, $resolveUsers, array $remoteList, array $remoteMap, $resolveRemotes, array $expected): void {
$this->manager->expects($this->once())
->method('getAccessList')
@@ -102,12 +100,12 @@ class ShareHelperTest extends TestCase {
}
/**
- * @dataProvider dataGetPathsForUsers
*
* @param array $users
* @param array $nodes
* @param array $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetPathsForUsers')]
public function testGetPathsForUsers(array $users, array $nodes, array $expected): void {
$lastNode = null;
foreach ($nodes as $nodeId => $nodeName) {
@@ -159,12 +157,12 @@ class ShareHelperTest extends TestCase {
}
/**
- * @dataProvider dataGetPathsForRemotes
*
* @param array $remotes
* @param array $nodes
* @param array $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetPathsForRemotes')]
public function testGetPathsForRemotes(array $remotes, array $nodes, array $expected): void {
$lastNode = null;
foreach ($nodes as $nodeId => $nodePath) {
@@ -199,10 +197,10 @@ class ShareHelperTest extends TestCase {
}
/**
- * @dataProvider dataGetMountedPath
* @param string $path
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetMountedPath')]
public function testGetMountedPath($path, $expected): void {
/** @var Node|\PHPUnit\Framework\MockObject\MockObject $node */
$node = $this->createMock(Node::class);
diff --git a/tests/lib/Share20/ShareTest.php b/tests/lib/Share20/ShareTest.php
index 7d6fcacfeaa..f15fbb860db 100644
--- a/tests/lib/Share20/ShareTest.php
+++ b/tests/lib/Share20/ShareTest.php
@@ -12,6 +12,7 @@ use OC\Share20\Share;
use OCP\Files\IRootFolder;
use OCP\IUserManager;
use OCP\Share\Exceptions\IllegalIDChangeException;
+use OCP\Share\IShare;
use PHPUnit\Framework\MockObject\MockObject;
/**
@@ -24,7 +25,7 @@ class ShareTest extends \Test\TestCase {
protected $rootFolder;
/** @var IUserManager|MockObject */
protected $userManager;
- /** @var \OCP\Share\IShare */
+ /** @var IShare */
protected $share;
protected function setUp(): void {
diff --git a/tests/lib/SubAdminTest.php b/tests/lib/SubAdminTest.php
index 20c63cdd21e..39bb72b445c 100644
--- a/tests/lib/SubAdminTest.php
+++ b/tests/lib/SubAdminTest.php
@@ -13,7 +13,9 @@ use OCP\EventDispatcher\IEventDispatcher;
use OCP\Group\Events\SubAdminAddedEvent;
use OCP\Group\Events\SubAdminRemovedEvent;
use OCP\IDBConnection;
+use OCP\IGroup;
use OCP\IGroupManager;
+use OCP\IUser;
use OCP\IUserManager;
use OCP\Server;
@@ -21,22 +23,22 @@ use OCP\Server;
* @group DB
*/
class SubAdminTest extends \Test\TestCase {
- /** @var \OCP\IUserManager */
+ /** @var IUserManager */
private $userManager;
- /** @var \OCP\IGroupManager */
+ /** @var IGroupManager */
private $groupManager;
- /** @var \OCP\IDBConnection */
+ /** @var IDBConnection */
private $dbConn;
/** @var IEventDispatcher */
private $eventDispatcher;
- /** @var \OCP\IUser[] */
+ /** @var IUser[] */
private $users;
- /** @var \OCP\IGroup[] */
+ /** @var IGroup[] */
private $groups;
protected function setUp(): void {
diff --git a/tests/lib/Support/Subscription/RegistryTest.php b/tests/lib/Support/Subscription/RegistryTest.php
index 3f2b9f5032f..e6e83d6038b 100644
--- a/tests/lib/Support/Subscription/RegistryTest.php
+++ b/tests/lib/Support/Subscription/RegistryTest.php
@@ -168,9 +168,7 @@ class RegistryTest extends TestCase {
];
}
- /**
- * @dataProvider dataForUserLimitCheck
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataForUserLimitCheck')]
public function testDelegateIsHardUserLimitReachedWithoutSupportAppAndUserCount($userLimit, $userCount, $disabledUsers, $expectedResult): void {
$this->config->expects($this->once())
->method('getSystemValueBool')
diff --git a/tests/lib/SystemTag/SystemTagManagerTest.php b/tests/lib/SystemTag/SystemTagManagerTest.php
index 806c3fea240..7bbe86aabe7 100644
--- a/tests/lib/SystemTag/SystemTagManagerTest.php
+++ b/tests/lib/SystemTag/SystemTagManagerTest.php
@@ -96,9 +96,7 @@ class SystemTagManagerTest extends TestCase {
];
}
- /**
- * @dataProvider getAllTagsDataProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('getAllTagsDataProvider')]
public function testGetAllTags($testTags): void {
$testTagsById = [];
foreach ($testTags as $testTag) {
@@ -205,9 +203,7 @@ class SystemTagManagerTest extends TestCase {
];
}
- /**
- * @dataProvider getAllTagsFilteredDataProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('getAllTagsFilteredDataProvider')]
public function testGetAllTagsFiltered($testTags, $visibilityFilter, $nameSearch, $expectedResults): void {
foreach ($testTags as $testTag) {
$this->tagManager->createTag($testTag[0], $testTag[1], $testTag[2]);
@@ -238,9 +234,7 @@ class SystemTagManagerTest extends TestCase {
];
}
- /**
- * @dataProvider oneTagMultipleFlagsProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('oneTagMultipleFlagsProvider')]
public function testCreateDuplicate($name, $userVisible, $userAssignable): void {
$this->expectException(TagAlreadyExistsException::class);
@@ -257,9 +251,7 @@ class SystemTagManagerTest extends TestCase {
$this->assertSame('Zona circundante do Palรกcio Nacional da Ajuda (Jardim das Damas', $tag->getName()); // 63 characters but 64 bytes due to "รก"
}
- /**
- * @dataProvider oneTagMultipleFlagsProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('oneTagMultipleFlagsProvider')]
public function testGetExistingTag($name, $userVisible, $userAssignable): void {
$tag1 = $this->tagManager->createTag($name, $userVisible, $userAssignable);
$tag2 = $this->tagManager->getTag($name, $userVisible, $userAssignable);
@@ -327,9 +319,7 @@ class SystemTagManagerTest extends TestCase {
];
}
- /**
- * @dataProvider updateTagProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('updateTagProvider')]
public function testUpdateTag($tagCreate, $tagUpdated): void {
$tag1 = $this->tagManager->createTag(
$tagCreate[0],
@@ -359,9 +349,7 @@ class SystemTagManagerTest extends TestCase {
}
- /**
- * @dataProvider updateTagProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('updateTagProvider')]
public function testUpdateTagDuplicate($tagCreate, $tagUpdated): void {
$this->expectException(TagAlreadyExistsException::class);
@@ -436,9 +424,7 @@ class SystemTagManagerTest extends TestCase {
];
}
- /**
- * @dataProvider visibilityCheckProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('visibilityCheckProvider')]
public function testVisibilityCheck($userVisible, $userAssignable, $isAdmin, $expectedResult): void {
$user = $this->getMockBuilder(IUser::class)->getMock();
$user->expects($this->any())
@@ -483,9 +469,7 @@ class SystemTagManagerTest extends TestCase {
];
}
- /**
- * @dataProvider assignabilityCheckProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('assignabilityCheckProvider')]
public function testAssignabilityCheck($userVisible, $userAssignable, $isAdmin, $expectedResult, $userGroupIds = [], $tagGroupIds = []): void {
$user = $this->getMockBuilder(IUser::class)->getMock();
$user->expects($this->any())
@@ -542,9 +526,7 @@ class SystemTagManagerTest extends TestCase {
];
}
- /**
- * @dataProvider allowedToCreateProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('allowedToCreateProvider')]
public function testAllowedToCreateTag(bool $isCli, ?bool $isAdmin, bool $isRestricted): void {
$oldCli = \OC::$CLI;
\OC::$CLI = $isCli;
@@ -580,9 +562,7 @@ class SystemTagManagerTest extends TestCase {
];
}
- /**
- * @dataProvider disallowedToCreateProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('disallowedToCreateProvider')]
public function testDisallowedToCreateTag(?bool $isAdmin): void {
$oldCli = \OC::$CLI;
\OC::$CLI = false;
diff --git a/tests/lib/TagsTest.php b/tests/lib/TagsTest.php
index 3fd882aa201..d47ce2d2178 100644
--- a/tests/lib/TagsTest.php
+++ b/tests/lib/TagsTest.php
@@ -12,6 +12,7 @@ use OC\Tagging\TagMapper;
use OC\TagManager;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IDBConnection;
+use OCP\ITagManager;
use OCP\IUser;
use OCP\IUserManager;
use OCP\IUserSession;
@@ -25,14 +26,14 @@ use Psr\Log\LoggerInterface;
*/
class TagsTest extends \Test\TestCase {
protected $objectType;
- /** @var \OCP\IUser */
+ /** @var IUser */
protected $user;
- /** @var \OCP\IUserSession */
+ /** @var IUserSession */
protected $userSession;
protected $backupGlobals = false;
/** @var \OC\Tagging\TagMapper */
protected $tagMapper;
- /** @var \OCP\ITagManager */
+ /** @var ITagManager */
protected $tagMgr;
protected function setUp(): void {
diff --git a/tests/lib/Template/JSCombinerTest.php b/tests/lib/Template/JSCombinerTest.php
index b83ae0aaed5..bc286695bc7 100644
--- a/tests/lib/Template/JSCombinerTest.php
+++ b/tests/lib/Template/JSCombinerTest.php
@@ -474,8 +474,8 @@ var b = \'world\';
* @param $appName
* @param $fileName
* @param $result
- * @dataProvider dataGetCachedSCSS
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetCachedSCSS')]
public function testGetCachedSCSS($appName, $fileName, $result): void {
$this->urlGenerator->expects($this->once())
->method('linkToRoute')
diff --git a/tests/lib/TemplateLayoutTest.php b/tests/lib/TemplateLayoutTest.php
index b3895525408..c1cafcd6b93 100644
--- a/tests/lib/TemplateLayoutTest.php
+++ b/tests/lib/TemplateLayoutTest.php
@@ -40,7 +40,7 @@ class TemplateLayoutTest extends \Test\TestCase {
$this->serverVersion = $this->createMock(ServerVersion::class);
}
- /** @dataProvider dataVersionHash */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataVersionHash')]
public function testVersionHash($path, $file, $installed, $debug, $expected): void {
$this->appManager->expects(self::any())
->method('getAppVersion')
diff --git a/tests/lib/TestCase.php b/tests/lib/TestCase.php
index e40ccad0dc0..e91e847e859 100644
--- a/tests/lib/TestCase.php
+++ b/tests/lib/TestCase.php
@@ -19,6 +19,7 @@ use OC\Files\Mount\LocalHomeMountProvider;
use OC\Files\Mount\RootMountProvider;
use OC\Files\ObjectStore\PrimaryObjectStoreConfig;
use OC\Files\SetupManager;
+use OC\Files\View;
use OC\Template\Base;
use OCP\Command\IBus;
use OCP\DB\QueryBuilder\IQueryBuilder;
@@ -493,7 +494,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase {
/**
* Check if the given path is locked with a given type
*
- * @param \OC\Files\View $view view
+ * @param View $view view
* @param string $path path to check
* @param int $type lock type
* @param bool $onMountPoint true to check the mount point instead of the
diff --git a/tests/lib/Traits/EncryptionTrait.php b/tests/lib/Traits/EncryptionTrait.php
index 4b4deba7450..50c20befc4d 100644
--- a/tests/lib/Traits/EncryptionTrait.php
+++ b/tests/lib/Traits/EncryptionTrait.php
@@ -43,12 +43,12 @@ trait EncryptionTrait {
private $setupManager;
/**
- * @var \OCP\IConfig
+ * @var IConfig
*/
private $config;
/**
- * @var \OCA\Encryption\AppInfo\Application
+ * @var Application
*/
private $encryptionApp;
diff --git a/tests/lib/Traits/MountProviderTrait.php b/tests/lib/Traits/MountProviderTrait.php
index 35d8cada7f3..b680c71b2d6 100644
--- a/tests/lib/Traits/MountProviderTrait.php
+++ b/tests/lib/Traits/MountProviderTrait.php
@@ -10,6 +10,7 @@ namespace Test\Traits;
use OC\Files\Mount\MountPoint;
use OC\Files\Storage\StorageFactory;
+use OCP\Files\Config\IMountProvider;
use OCP\Files\Config\IMountProviderCollection;
use OCP\IUser;
use OCP\Server;
@@ -19,7 +20,7 @@ use OCP\Server;
*/
trait MountProviderTrait {
/**
- * @var \OCP\Files\Config\IMountProvider
+ * @var IMountProvider
*/
protected $mountProvider;
diff --git a/tests/lib/Traits/UserTrait.php b/tests/lib/Traits/UserTrait.php
index 0e330aee9b8..f80adb76be8 100644
--- a/tests/lib/Traits/UserTrait.php
+++ b/tests/lib/Traits/UserTrait.php
@@ -13,6 +13,7 @@ use OCP\EventDispatcher\IEventDispatcher;
use OCP\IUser;
use OCP\IUserManager;
use OCP\Server;
+use OCP\UserInterface;
class DummyUser extends User {
public function __construct(
@@ -31,7 +32,7 @@ class DummyUser extends User {
*/
trait UserTrait {
/**
- * @var \Test\Util\User\Dummy|\OCP\UserInterface
+ * @var \Test\Util\User\Dummy|UserInterface
*/
protected $userBackend;
diff --git a/tests/lib/Updater/ChangesCheckTest.php b/tests/lib/Updater/ChangesCheckTest.php
index 6b5b306d8f7..dd0d97a9e80 100644
--- a/tests/lib/Updater/ChangesCheckTest.php
+++ b/tests/lib/Updater/ChangesCheckTest.php
@@ -51,9 +51,7 @@ class ChangesCheckTest extends TestCase {
];
}
- /**
- * @dataProvider statusCodeProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('statusCodeProvider')]
public function testEvaluateResponse(int $statusCode, int $expected): void {
$response = $this->createMock(IResponse::class);
$response->expects($this->atLeastOnce())
@@ -271,9 +269,7 @@ class ChangesCheckTest extends TestCase {
];
}
- /**
- * @dataProvider changesXMLProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('changesXMLProvider')]
public function testExtractData(string $body, array $expected): void {
$actual = $this->invokePrivate($this->checker, 'extractData', [$body]);
$this->assertSame($expected, $actual);
@@ -286,9 +282,7 @@ class ChangesCheckTest extends TestCase {
];
}
- /**
- * @dataProvider etagProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('etagProvider')]
public function testQueryChangesServer(string $etag): void {
$uri = 'https://changes.nextcloud.server/?13.0.5';
$entry = $this->createMock(Changes::class);
@@ -323,9 +317,7 @@ class ChangesCheckTest extends TestCase {
];
}
- /**
- * @dataProvider versionProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('versionProvider')]
public function testNormalizeVersion(string $input, string $expected): void {
$normalized = $this->checker->normalizeVersion($input);
$this->assertSame($expected, $normalized);
@@ -342,10 +334,7 @@ class ChangesCheckTest extends TestCase {
return array_merge($testDataFound, $testDataNotFound);
}
- /**
- * @dataProvider changeDataProvider
- *
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('changeDataProvider')]
public function testGetChangesForVersion(string $inputVersion, string $normalizedVersion, bool $isFound): void {
$mocker = $this->mapper->expects($this->once())
->method('getChanges')
diff --git a/tests/lib/Updater/ReleaseMetadataTest.php b/tests/lib/Updater/ReleaseMetadataTest.php
index 335425b7672..e93d9fe64be 100644
--- a/tests/lib/Updater/ReleaseMetadataTest.php
+++ b/tests/lib/Updater/ReleaseMetadataTest.php
@@ -41,11 +41,11 @@ class ReleaseMetadataTest extends \Test\TestCase {
}
/**
- * @dataProvider getMetadataUrlProvider
*
* @param string $version
* @param string $url
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('getMetadataUrlProvider')]
public function testGetMetadata(string $version, string $url): void {
$client = $this->createMock(IClient::class);
$response = $this->createMock(IResponse::class);
diff --git a/tests/lib/UpdaterTest.php b/tests/lib/UpdaterTest.php
index 3f5d24d3d92..37a4a105628 100644
--- a/tests/lib/UpdaterTest.php
+++ b/tests/lib/UpdaterTest.php
@@ -82,7 +82,6 @@ class UpdaterTest extends TestCase {
}
/**
- * @dataProvider versionCompatibilityTestData
*
* @param string $oldVersion
* @param string $newVersion
@@ -91,6 +90,7 @@ class UpdaterTest extends TestCase {
* @param bool $debug
* @param string $vendor
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('versionCompatibilityTestData')]
public function testIsUpgradePossible($oldVersion, $newVersion, $allowedVersions, $result, $debug = false, $vendor = 'nextcloud'): void {
$this->config->expects($this->any())
->method('getSystemValueBool')
diff --git a/tests/lib/UrlGeneratorTest.php b/tests/lib/UrlGeneratorTest.php
index 48460519177..4320efc4190 100644
--- a/tests/lib/UrlGeneratorTest.php
+++ b/tests/lib/UrlGeneratorTest.php
@@ -71,8 +71,8 @@ class UrlGeneratorTest extends \Test\TestCase {
/**
* @small
* test linkTo URL construction
- * @dataProvider provideDocRootAppUrlParts
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('provideDocRootAppUrlParts')]
public function testLinkToDocRoot($app, $file, $args, $expectedResult): void {
\OC::$WEBROOT = '';
$result = $this->urlGenerator->linkTo($app, $file, $args);
@@ -82,17 +82,15 @@ class UrlGeneratorTest extends \Test\TestCase {
/**
* @small
* test linkTo URL construction in sub directory
- * @dataProvider provideSubDirAppUrlParts
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('provideSubDirAppUrlParts')]
public function testLinkToSubDir($app, $file, $args, $expectedResult): void {
\OC::$WEBROOT = '/nextcloud';
$result = $this->urlGenerator->linkTo($app, $file, $args);
$this->assertEquals($expectedResult, $result);
}
- /**
- * @dataProvider provideRoutes
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('provideRoutes')]
public function testLinkToRouteAbsolute($route, $expected): void {
$this->mockBaseUrl();
\OC::$WEBROOT = '/nextcloud';
@@ -135,8 +133,8 @@ class UrlGeneratorTest extends \Test\TestCase {
/**
* @small
* test absolute URL construction
- * @dataProvider provideDocRootURLs
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('provideDocRootURLs')]
public function testGetAbsoluteURLDocRoot($url, $expectedResult): void {
$this->mockBaseUrl();
\OC::$WEBROOT = '';
@@ -147,8 +145,8 @@ class UrlGeneratorTest extends \Test\TestCase {
/**
* @small
* test absolute URL construction
- * @dataProvider provideSubDirURLs
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('provideSubDirURLs')]
public function testGetAbsoluteURLSubDir($url, $expectedResult): void {
$this->mockBaseUrl();
\OC::$WEBROOT = '/nextcloud';
@@ -190,9 +188,7 @@ class UrlGeneratorTest extends \Test\TestCase {
$this->assertEquals(\OC::$WEBROOT, $actual);
}
- /**
- * @dataProvider provideOCSRoutes
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('provideOCSRoutes')]
public function testLinkToOCSRouteAbsolute(string $route, bool $ignoreFrontController, string $expected): void {
$this->mockBaseUrl();
\OC::$WEBROOT = '/nextcloud';
@@ -277,9 +273,7 @@ class UrlGeneratorTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider imagePathProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('imagePathProvider')]
public function testImagePath(string $appName, string $file, string $result): void {
$this->assertSame($result, $this->urlGenerator->imagePath($appName, $file));
}
diff --git a/tests/lib/User/ManagerTest.php b/tests/lib/User/ManagerTest.php
index 57041c0ef22..d5872787d0a 100644
--- a/tests/lib/User/ManagerTest.php
+++ b/tests/lib/User/ManagerTest.php
@@ -368,9 +368,7 @@ class ManagerTest extends TestCase {
];
}
- /**
- * @dataProvider dataCreateUserInvalid
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataCreateUserInvalid')]
public function testCreateUserInvalid($uid, $password, $exception): void {
/** @var \Test\Util\User\Dummy|\PHPUnit\Framework\MockObject\MockObject $backend */
$backend = $this->createMock(\Test\Util\User\Dummy::class);
diff --git a/tests/lib/User/SessionTest.php b/tests/lib/User/SessionTest.php
index 99bf7f62bb3..50c449559a0 100644
--- a/tests/lib/User/SessionTest.php
+++ b/tests/lib/User/SessionTest.php
@@ -112,9 +112,7 @@ class SessionTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider isLoggedInData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('isLoggedInData')]
public function testIsLoggedIn($isLoggedIn): void {
$session = $this->createMock(Memory::class);
diff --git a/tests/lib/User/UserTest.php b/tests/lib/User/UserTest.php
index e386d0c2c10..05056c92193 100644
--- a/tests/lib/User/UserTest.php
+++ b/tests/lib/User/UserTest.php
@@ -506,10 +506,10 @@ class UserTest extends TestCase {
}
/**
- * @dataProvider dataDeleteHooks
* @param bool $result
* @param int $expectedHooks
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataDeleteHooks')]
public function testDeleteHooks($result, $expectedHooks): void {
$hooksCalled = 0;
$test = $this;
@@ -659,9 +659,7 @@ class UserTest extends TestCase {
];
}
- /**
- * @dataProvider dataGetCloudId
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetCloudId')]
public function testGetCloudId(string $absoluteUrl, string $cloudId): void {
/** @var Backend|MockObject $backend */
$backend = $this->createMock(\Test\Util\User\Dummy::class);
diff --git a/tests/lib/UtilCheckServerTest.php b/tests/lib/UtilCheckServerTest.php
index 2e2cc4cab42..087c67120a3 100644
--- a/tests/lib/UtilCheckServerTest.php
+++ b/tests/lib/UtilCheckServerTest.php
@@ -8,6 +8,7 @@
namespace Test;
+use OC\SystemConfig;
use OCP\ISession;
use OCP\ITempManager;
use OCP\Server;
@@ -23,7 +24,7 @@ class UtilCheckServerTest extends \Test\TestCase {
/**
* @param array $systemOptions
- * @return \OC\SystemConfig | \PHPUnit\Framework\MockObject\MockObject
+ * @return SystemConfig|\PHPUnit\Framework\MockObject\MockObject
*/
protected function getConfig($systemOptions) {
$systemOptions['datadirectory'] = $this->datadir;
diff --git a/tests/lib/UtilTest.php b/tests/lib/UtilTest.php
index dcdb3d951b2..6d995be2434 100644
--- a/tests/lib/UtilTest.php
+++ b/tests/lib/UtilTest.php
@@ -341,9 +341,7 @@ class UtilTest extends \Test\TestCase {
$this->assertEquals('๐Ÿ™ˆ', Util::shortenMultibyteString('๐Ÿ™ˆ๐Ÿ™Š๐Ÿ™‰', 16, 2));
}
- /**
- * @dataProvider humanFileSizeProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('humanFileSizeProvider')]
public function testHumanFileSize($expected, $input): void {
$result = Util::humanFileSize($input);
$this->assertEquals($expected, $result);
@@ -361,9 +359,7 @@ class UtilTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider providesComputerFileSize
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('providesComputerFileSize')]
public function testComputerFileSize($expected, $input): void {
$result = Util::computerFileSize($input);
$this->assertEquals($expected, $result);