diff options
Diffstat (limited to 'tests/lib/Encryption/UtilTest.php')
-rw-r--r-- | tests/lib/Encryption/UtilTest.php | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/tests/lib/Encryption/UtilTest.php b/tests/lib/Encryption/UtilTest.php index 68989c55fb0..d1fefee872a 100644 --- a/tests/lib/Encryption/UtilTest.php +++ b/tests/lib/Encryption/UtilTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -6,6 +7,7 @@ */ namespace Test\Encryption; +use OC\Encryption\Exceptions\EncryptionHeaderKeyExistsException; use OC\Encryption\Util; use OC\Files\View; use OCP\Encryption\IEncryptionModule; @@ -53,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); @@ -69,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); @@ -91,7 +89,7 @@ class UtilTest extends TestCase { public function testCreateHeaderFailed(): void { - $this->expectException(\OC\Encryption\Exceptions\EncryptionHeaderKeyExistsException::class); + $this->expectException(EncryptionHeaderKeyExistsException::class); $header = ['header1' => 1, 'header2' => 2, 'oc_encryption_module' => 'foo']; @@ -102,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') @@ -143,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) @@ -165,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)); @@ -184,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); @@ -212,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'; |