aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Files
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2025-06-30 16:56:59 +0200
committerRobin Appelman <robin@icewind.nl>2025-07-01 22:45:52 +0200
commitaa15f9d16d5b46d04763c7deedb129990e819364 (patch)
tree758e0aebcac34a545f9a21806120a9fcb96f4cb6 /tests/lib/Files
parent1620a0c0510a42b1da0a66488838f1ce3ba1210d (diff)
downloadnextcloud-server-rector-phpunit10.tar.gz
nextcloud-server-rector-phpunit10.zip
chore: run rectorrector-phpunit10
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests/lib/Files')
-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
39 files changed, 189 insertions, 268 deletions
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('/');