diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Encryption/DecryptAllTest.php | 6 | ||||
-rw-r--r-- | tests/lib/Encryption/EncryptionWrapperTest.php | 7 | ||||
-rw-r--r-- | tests/lib/Files/Mount/MountPointTest.php | 4 | ||||
-rw-r--r-- | tests/lib/Files/Node/FolderTest.php | 18 | ||||
-rw-r--r-- | tests/lib/Files/Node/NodeTest.php | 4 | ||||
-rw-r--r-- | tests/lib/Files/Storage/Storage.php | 3 | ||||
-rw-r--r-- | tests/lib/Files/Storage/StorageFactoryTest.php | 2 | ||||
-rw-r--r-- | tests/lib/Lockdown/Filesystem/NullStorageTest.php | 6 | ||||
-rw-r--r-- | tests/lib/Share20/ManagerTest.php | 26 |
9 files changed, 39 insertions, 37 deletions
diff --git a/tests/lib/Encryption/DecryptAllTest.php b/tests/lib/Encryption/DecryptAllTest.php index d073efc8235..6a8453bcaf8 100644 --- a/tests/lib/Encryption/DecryptAllTest.php +++ b/tests/lib/Encryption/DecryptAllTest.php @@ -12,7 +12,7 @@ use OC\Encryption\Exceptions\DecryptionFailedException; use OC\Encryption\Manager; use OC\Files\FileInfo; use OC\Files\View; -use OCP\Files\Storage; +use OCP\Files\Storage\IStorage; use OCP\IUserManager; use OCP\UserInterface; use Symfony\Component\Console\Formatter\OutputFormatterInterface; @@ -246,11 +246,11 @@ class DecryptAllTest extends TestCase { ->setMethods(['decryptFile']) ->getMock(); - $storage = $this->getMockBuilder(Storage::class) + $storage = $this->getMockBuilder(IStorage::class) ->disableOriginalConstructor()->getMock(); - $sharedStorage = $this->getMockBuilder(Storage::class) + $sharedStorage = $this->getMockBuilder(IStorage::class) ->disableOriginalConstructor()->getMock(); $sharedStorage->expects($this->once())->method('instanceOfStorage') diff --git a/tests/lib/Encryption/EncryptionWrapperTest.php b/tests/lib/Encryption/EncryptionWrapperTest.php index 1ecb9dc89c7..1ac7342a3d8 100644 --- a/tests/lib/Encryption/EncryptionWrapperTest.php +++ b/tests/lib/Encryption/EncryptionWrapperTest.php @@ -10,7 +10,8 @@ namespace Test\Encryption; use OC\Encryption\EncryptionWrapper; use OC\Encryption\Manager; use OC\Memcache\ArrayCache; -use OCP\Files\Storage; +use OCP\Files\Storage\IDisableEncryptionStorage; +use OCP\Files\Storage\IStorage; use Psr\Log\LoggerInterface; use Test\TestCase; @@ -42,7 +43,7 @@ class EncryptionWrapperTest extends TestCase { * @dataProvider provideWrapStorage */ public function testWrapStorage($expectedWrapped, $wrappedStorages): void { - $storage = $this->getMockBuilder(Storage::class) + $storage = $this->getMockBuilder(IStorage::class) ->disableOriginalConstructor() ->getMock(); @@ -74,7 +75,7 @@ class EncryptionWrapperTest extends TestCase { [true, ['OCA\Files_Trashbin\Storage']], // Do not wrap shared storages - [false, [Storage\IDisableEncryptionStorage::class]], + [false, [IDisableEncryptionStorage::class]], ]; } } diff --git a/tests/lib/Files/Mount/MountPointTest.php b/tests/lib/Files/Mount/MountPointTest.php index eda61feb249..3de54e315a1 100644 --- a/tests/lib/Files/Mount/MountPointTest.php +++ b/tests/lib/Files/Mount/MountPointTest.php @@ -8,14 +8,14 @@ namespace Test\Files\Mount; use OC\Files\Storage\StorageFactory; -use OCP\Files\Storage; +use OCP\Files\Storage\IStorage; class DummyStorage { } class MountPointTest extends \Test\TestCase { public function testGetStorage(): void { - $storage = $this->createMock(Storage::class); + $storage = $this->createMock(IStorage::class); $storage->expects($this->once()) ->method('getId') ->willReturn(123); diff --git a/tests/lib/Files/Node/FolderTest.php b/tests/lib/Files/Node/FolderTest.php index 2e3b6e369d3..5af409a1a93 100644 --- a/tests/lib/Files/Node/FolderTest.php +++ b/tests/lib/Files/Node/FolderTest.php @@ -28,7 +28,7 @@ use OCP\Files\Mount\IMountPoint; use OCP\Files\NotFoundException; use OCP\Files\Search\ISearchComparison; use OCP\Files\Search\ISearchOrder; -use OCP\Files\Storage; +use OCP\Files\Storage\IStorage; use PHPUnit\Framework\MockObject\MockObject; /** @@ -292,7 +292,7 @@ class FolderTest extends NodeTest { $root->method('getUser') ->willReturn($this->user); /** @var Storage\IStorage&MockObject $storage */ - $storage = $this->createMock(Storage\IStorage::class); + $storage = $this->createMock(IStorage::class); $storage->method('getId')->willReturn('test::1'); $cache = new Cache($storage); @@ -341,7 +341,7 @@ class FolderTest extends NodeTest { ->method('getUser') ->willReturn($this->user); /** @var \PHPUnit\Framework\MockObject\MockObject|Storage $storage */ - $storage = $this->createMock(Storage::class); + $storage = $this->createMock(IStorage::class); $storage->method('getId')->willReturn('test::2'); $cache = new Cache($storage); @@ -379,7 +379,7 @@ class FolderTest extends NodeTest { ->getMock(); $root->method('getUser') ->willReturn($this->user); - $storage = $this->createMock(Storage::class); + $storage = $this->createMock(IStorage::class); $storage->method('getId')->willReturn('test::1'); $cache = new Cache($storage); @@ -420,10 +420,10 @@ class FolderTest extends NodeTest { $root->expects($this->any()) ->method('getUser') ->willReturn($this->user); - $storage = $this->createMock(Storage::class); + $storage = $this->createMock(IStorage::class); $storage->method('getId')->willReturn('test::1'); $cache = new Cache($storage); - $subStorage = $this->createMock(Storage::class); + $subStorage = $this->createMock(IStorage::class); $subStorage->method('getId')->willReturn('test::2'); $subCache = new Cache($subStorage); $subMount = $this->getMockBuilder(MountPoint::class)->setConstructorArgs([Temporary::class, ''])->getMock(); @@ -922,14 +922,14 @@ class FolderTest extends NodeTest { $root->expects($this->any()) ->method('getUser') ->willReturn($this->user); - $storage = $this->createMock(Storage::class); + $storage = $this->createMock(IStorage::class); $storage->method('getId')->willReturn('test::1'); $cache = new Cache($storage); - $subStorage1 = $this->createMock(Storage::class); + $subStorage1 = $this->createMock(IStorage::class); $subStorage1->method('getId')->willReturn('test::2'); $subCache1 = new Cache($subStorage1); $subMount1 = $this->getMockBuilder(MountPoint::class)->setConstructorArgs([Temporary::class, ''])->getMock(); - $subStorage2 = $this->createMock(Storage::class); + $subStorage2 = $this->createMock(IStorage::class); $subStorage2->method('getId')->willReturn('test::3'); $subCache2 = new Cache($subStorage2); $subMount2 = $this->getMockBuilder(MountPoint::class)->setConstructorArgs([Temporary::class, ''])->getMock(); diff --git a/tests/lib/Files/Node/NodeTest.php b/tests/lib/Files/Node/NodeTest.php index d12448a2481..db87aa925d3 100644 --- a/tests/lib/Files/Node/NodeTest.php +++ b/tests/lib/Files/Node/NodeTest.php @@ -16,7 +16,7 @@ use OCP\Files\IRootFolder; use OCP\Files\Mount\IMountPoint; use OCP\Files\Node; use OCP\Files\NotFoundException; -use OCP\Files\Storage; +use OCP\Files\Storage\IStorage; use OCP\ICacheFactory; use OCP\IUser; use OCP\IUserManager; @@ -111,7 +111,7 @@ abstract class NodeTest extends \Test\TestCase { abstract protected function getViewDeleteMethod(); protected function getMockStorage() { - $storage = $this->getMockBuilder(Storage::class) + $storage = $this->getMockBuilder(IStorage::class) ->disableOriginalConstructor() ->getMock(); $storage->expects($this->any()) diff --git a/tests/lib/Files/Storage/Storage.php b/tests/lib/Files/Storage/Storage.php index 5b0bbf2f95b..36d70965848 100644 --- a/tests/lib/Files/Storage/Storage.php +++ b/tests/lib/Files/Storage/Storage.php @@ -8,6 +8,7 @@ namespace Test\Files\Storage; use OC\Files\Cache\Watcher; +use OCP\Files\Storage\IStorage; use OCP\Files\Storage\IWriteStreamStorage; abstract class Storage extends \Test\TestCase { @@ -572,7 +573,7 @@ abstract class Storage extends \Test\TestCase { } public function testInstanceOfStorage(): void { - $this->assertTrue($this->instance->instanceOfStorage('\OCP\Files\Storage')); + $this->assertTrue($this->instance->instanceOfStorage(IStorage::class)); $this->assertTrue($this->instance->instanceOfStorage(get_class($this->instance))); $this->assertFalse($this->instance->instanceOfStorage('\OC')); } diff --git a/tests/lib/Files/Storage/StorageFactoryTest.php b/tests/lib/Files/Storage/StorageFactoryTest.php index 66f2a2af9a6..d1e8d927dc9 100644 --- a/tests/lib/Files/Storage/StorageFactoryTest.php +++ b/tests/lib/Files/Storage/StorageFactoryTest.php @@ -10,7 +10,7 @@ namespace Test\Files\Storage; use OC\Files\Mount\MountPoint; use OC\Files\Storage\Wrapper\Wrapper; use OCP\Files\Mount\IMountPoint; -use OCP\Files\Storage as IStorage; +use OCP\Files\Storage\IStorage; use Test\TestCase; class DummyWrapper extends Wrapper { diff --git a/tests/lib/Lockdown/Filesystem/NullStorageTest.php b/tests/lib/Lockdown/Filesystem/NullStorageTest.php index 331adeb8a54..cc65221d0a3 100644 --- a/tests/lib/Lockdown/Filesystem/NullStorageTest.php +++ b/tests/lib/Lockdown/Filesystem/NullStorageTest.php @@ -11,7 +11,7 @@ use OC\Files\FileInfo; use OC\ForbiddenException; use OC\Lockdown\Filesystem\NullCache; use OC\Lockdown\Filesystem\NullStorage; -use OCP\Files\Storage; +use OCP\Files\Storage\IStorage; use Test\TestCase; class NullStorageTest extends TestCase { @@ -196,7 +196,7 @@ class NullStorageTest extends TestCase { } public function testCopyFromStorage(): void { - $sourceStorage = $this->createMock(Storage::class); + $sourceStorage = $this->createMock(IStorage::class); $this->expectException(ForbiddenException::class); $this->expectExceptionMessage('This request is not allowed to access the filesystem'); @@ -205,7 +205,7 @@ class NullStorageTest extends TestCase { } public function testMoveFromStorage(): void { - $sourceStorage = $this->createMock(Storage::class); + $sourceStorage = $this->createMock(IStorage::class); $this->expectException(ForbiddenException::class); $this->expectExceptionMessage('This request is not allowed to access the filesystem'); diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php index 2250e28bd13..d0c43b2862c 100644 --- a/tests/lib/Share20/ManagerTest.php +++ b/tests/lib/Share20/ManagerTest.php @@ -23,7 +23,7 @@ use OCP\Files\IRootFolder; use OCP\Files\Mount\IMountManager; use OCP\Files\Mount\IMountPoint; use OCP\Files\Node; -use OCP\Files\Storage; +use OCP\Files\Storage\IStorage; use OCP\HintException; use OCP\IConfig; use OCP\IDateTimeZone; @@ -631,7 +631,7 @@ class ManagerTest extends \Test\TestCase { $file = $this->createMock(File::class); $node = $this->createMock(Node::class); - $storage = $this->createMock(Storage\IStorage::class); + $storage = $this->createMock(IStorage::class); $storage->method('instanceOfStorage') ->with('\OCA\Files_Sharing\External\Storage') ->willReturn(false); @@ -706,7 +706,7 @@ class ManagerTest extends \Test\TestCase { $data[] = [$this->createShare(null, IShare::TYPE_GROUP, $limitedPermssions, $group0, $user0, $user0, 17, null, null), 'Cannot increase permissions of path', true]; $data[] = [$this->createShare(null, IShare::TYPE_LINK, $limitedPermssions, null, $user0, $user0, 3, null, null), 'Cannot increase permissions of path', true]; - $nonMovableStorage = $this->createMock(Storage\IStorage::class); + $nonMovableStorage = $this->createMock(IStorage::class); $nonMovableStorage->method('instanceOfStorage') ->with('\OCA\Files_Sharing\External\Storage') ->willReturn(false); @@ -752,7 +752,7 @@ class ManagerTest extends \Test\TestCase { $data[] = [$this->createShare(null, IShare::TYPE_LINK, $allPermssions, null, $user0, $user0, 17, null, null), null, false]; - $remoteStorage = $this->createMock(Storage\IStorage::class); + $remoteStorage = $this->createMock(IStorage::class); $remoteStorage->method('instanceOfStorage') ->with('\OCA\Files_Sharing\External\Storage') ->willReturn(true); @@ -2059,7 +2059,7 @@ class ManagerTest extends \Test\TestCase { $path->method('getPath')->willReturn('path'); $mount = $this->createMock(IMountPoint::class); - $storage = $this->createMock(Storage::class); + $storage = $this->createMock(IStorage::class); $mount->method('getStorage')->willReturn($storage); $storage->method('instanceOfStorage')->with('\OCA\Files_Sharing\ISharedStorage')->willReturn(true); @@ -2073,7 +2073,7 @@ class ManagerTest extends \Test\TestCase { $path->method('getPath')->willReturn('path'); $mount = $this->createMock(IMountPoint::class); - $storage = $this->createMock(Storage::class); + $storage = $this->createMock(IStorage::class); $mount->method('getStorage')->willReturn($storage); $storage->method('instanceOfStorage')->with('\OCA\Files_Sharing\ISharedStorage')->willReturn(false); @@ -2221,7 +2221,7 @@ class ManagerTest extends \Test\TestCase { $shareOwner = $this->createMock(IUser::class); $shareOwner->method('getUID')->willReturn('shareOwner'); - $storage = $this->createMock(Storage::class); + $storage = $this->createMock(IStorage::class); $path = $this->createMock(File::class); $path->method('getOwner')->willReturn($shareOwner); $path->method('getName')->willReturn('target'); @@ -2276,7 +2276,7 @@ class ManagerTest extends \Test\TestCase { $shareOwner = $this->createMock(IUser::class); $shareOwner->method('getUID')->willReturn('shareOwner'); - $storage = $this->createMock(Storage::class); + $storage = $this->createMock(IStorage::class); $path = $this->createMock(File::class); $path->method('getOwner')->willReturn($shareOwner); $path->method('getName')->willReturn('target'); @@ -2339,7 +2339,7 @@ class ManagerTest extends \Test\TestCase { $shareOwner = $this->createMock(IUser::class); $shareOwner->method('getUID')->willReturn('shareOwner'); - $storage = $this->createMock(Storage::class); + $storage = $this->createMock(IStorage::class); $path = $this->createMock(File::class); $path->method('getOwner')->willReturn($shareOwner); $path->method('getName')->willReturn('target'); @@ -2459,7 +2459,7 @@ class ManagerTest extends \Test\TestCase { $shareOwner = $this->createMock(IUser::class); $shareOwner->method('getUID')->willReturn('shareOwner'); - $storage = $this->createMock(Storage::class); + $storage = $this->createMock(IStorage::class); $path = $this->createMock(File::class); $path->method('getOwner')->willReturn($shareOwner); $path->method('getName')->willReturn('target'); @@ -2563,7 +2563,7 @@ class ManagerTest extends \Test\TestCase { $shareOwner = $this->createMock(IUser::class); $shareOwner->method('getUID')->willReturn('shareOwner'); - $storage = $this->createMock(Storage::class); + $storage = $this->createMock(IStorage::class); $path = $this->createMock(File::class); $path->method('getOwner')->willReturn($shareOwner); $path->method('getName')->willReturn('target'); @@ -2623,12 +2623,12 @@ class ManagerTest extends \Test\TestCase { $shareOwner = $this->createMock(IUser::class); $shareOwner->method('getUID')->willReturn('shareOwner'); - $storage = $this->createMock(Storage::class); + $storage = $this->createMock(IStorage::class); $storage->method('instanceOfStorage') ->with('OCA\Files_Sharing\External\Storage') ->willReturn(true); - $storage2 = $this->createMock(Storage::class); + $storage2 = $this->createMock(IStorage::class); $storage2->method('instanceOfStorage') ->with('OCA\Files_Sharing\External\Storage') ->willReturn(false); |