diff options
Diffstat (limited to 'tests/lib/Encryption/EncryptionWrapperTest.php')
-rw-r--r-- | tests/lib/Encryption/EncryptionWrapperTest.php | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/tests/lib/Encryption/EncryptionWrapperTest.php b/tests/lib/Encryption/EncryptionWrapperTest.php index 1ac7342a3d8..58bf5aff005 100644 --- a/tests/lib/Encryption/EncryptionWrapperTest.php +++ b/tests/lib/Encryption/EncryptionWrapperTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -9,7 +10,10 @@ namespace Test\Encryption; use OC\Encryption\EncryptionWrapper; use OC\Encryption\Manager; +use OC\Files\Storage\Wrapper\Encryption; use OC\Memcache\ArrayCache; +use OCA\Files_Trashbin\Storage; +use OCP\Files\Mount\IMountPoint; use OCP\Files\Storage\IDisableEncryptionStorage; use OCP\Files\Storage\IStorage; use Psr\Log\LoggerInterface; @@ -25,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 { @@ -39,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() @@ -55,7 +57,7 @@ class EncryptionWrapperTest extends TestCase { ]); } - $mount = $this->getMockBuilder('OCP\Files\Mount\IMountPoint') + $mount = $this->getMockBuilder(IMountPoint::class) ->disableOriginalConstructor() ->getMock(); @@ -63,16 +65,16 @@ class EncryptionWrapperTest extends TestCase { $this->assertEquals( $expectedWrapped, - $returnedStorage->instanceOfStorage('OC\Files\Storage\Wrapper\Encryption'), + $returnedStorage->instanceOfStorage(Encryption::class), 'Asserted that the storage is (not) wrapped with encryption' ); } - public function provideWrapStorage() { + public static function provideWrapStorage(): array { return [ // Wrap when not wrapped or not wrapped with storage [true, []], - [true, ['OCA\Files_Trashbin\Storage']], + [true, [Storage::class]], // Do not wrap shared storages [false, [IDisableEncryptionStorage::class]], |