diff options
author | provokateurin <kate@provokateurin.de> | 2024-10-01 16:12:30 +0200 |
---|---|---|
committer | provokateurin <kate@provokateurin.de> | 2024-10-07 15:00:05 +0200 |
commit | f28e74b7a8b3df11ba1f2e4a18492b8158528cdf (patch) | |
tree | 90ff25fb002ca23f256bf9d6cf380bd46e23396d /tests | |
parent | 414430980a9efa3ced924d092ef50d336b2b7dde (diff) | |
download | nextcloud-server-f28e74b7a8b3df11ba1f2e4a18492b8158528cdf.tar.gz nextcloud-server-f28e74b7a8b3df11ba1f2e4a18492b8158528cdf.zip |
refactor(Storage): Make all parameter types strong types
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Files/Mount/MountPointTest.php | 8 | ||||
-rw-r--r-- | tests/lib/Files/Storage/CopyDirectoryTest.php | 6 | ||||
-rw-r--r-- | tests/lib/Files/ViewTest.php | 12 |
3 files changed, 12 insertions, 14 deletions
diff --git a/tests/lib/Files/Mount/MountPointTest.php b/tests/lib/Files/Mount/MountPointTest.php index 3de54e315a1..96987c9f5eb 100644 --- a/tests/lib/Files/Mount/MountPointTest.php +++ b/tests/lib/Files/Mount/MountPointTest.php @@ -8,11 +8,9 @@ namespace Test\Files\Mount; use OC\Files\Storage\StorageFactory; +use OC\Lockdown\Filesystem\NullStorage; use OCP\Files\Storage\IStorage; -class DummyStorage { -} - class MountPointTest extends \Test\TestCase { public function testGetStorage(): void { $storage = $this->createMock(IStorage::class); @@ -27,7 +25,7 @@ class MountPointTest extends \Test\TestCase { $mountPoint = new \OC\Files\Mount\MountPoint( // just use this because a real class is needed - '\Test\Files\Mount\DummyStorage', + NullStorage::class, '/mountpoint', null, $loader @@ -54,7 +52,7 @@ class MountPointTest extends \Test\TestCase { $mountPoint = new \OC\Files\Mount\MountPoint( // just use this because a real class is needed - '\Test\Files\Mount\DummyStorage', + NullStorage::class, '/mountpoint', null, $loader diff --git a/tests/lib/Files/Storage/CopyDirectoryTest.php b/tests/lib/Files/Storage/CopyDirectoryTest.php index c08bb6f6482..e434c6b787f 100644 --- a/tests/lib/Files/Storage/CopyDirectoryTest.php +++ b/tests/lib/Files/Storage/CopyDirectoryTest.php @@ -10,11 +10,11 @@ namespace Test\Files\Storage; use OC\Files\Storage\Temporary; class StorageNoRecursiveCopy extends Temporary { - public function copy($path1, $path2): bool { - if ($this->is_dir($path1)) { + public function copy(string $source, string $target): bool { + if ($this->is_dir($source)) { return false; } - return copy($this->getSourcePath($path1), $this->getSourcePath($path2)); + return copy($this->getSourcePath($source), $this->getSourcePath($target)); } } diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php index e393476bd05..2a74558c70d 100644 --- a/tests/lib/Files/ViewTest.php +++ b/tests/lib/Files/ViewTest.php @@ -37,27 +37,27 @@ use Test\TestMoveableMountPoint; use Test\Traits\UserTrait; class TemporaryNoTouch extends Temporary { - public function touch($path, $mtime = null): bool { + public function touch(string $path, ?int $mtime = null): bool { return false; } } class TemporaryNoCross extends Temporary { - public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = null): bool { + public function copyFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath, bool $preserveMtime = false): bool { return Common::copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime); } - public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath): bool { + public function moveFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): bool { return Common::moveFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath); } } class TemporaryNoLocal extends Temporary { - public function instanceOfStorage($className): bool { - if ($className === '\OC\Files\Storage\Local') { + public function instanceOfStorage(string $class): bool { + if ($class === '\OC\Files\Storage\Local') { return false; } else { - return parent::instanceOfStorage($className); + return parent::instanceOfStorage($class); } } } |