aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Encryption/UtilTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Encryption/UtilTest.php')
-rw-r--r--tests/lib/Encryption/UtilTest.php57
1 files changed, 27 insertions, 30 deletions
diff --git a/tests/lib/Encryption/UtilTest.php b/tests/lib/Encryption/UtilTest.php
index e503da109a8..e1d898f5a86 100644
--- a/tests/lib/Encryption/UtilTest.php
+++ b/tests/lib/Encryption/UtilTest.php
@@ -56,7 +56,6 @@ class UtilTest extends TestCase {
$this->groupManager,
$this->config
);
-
}
/**
@@ -79,7 +78,6 @@ class UtilTest extends TestCase {
* @dataProvider providesHeaders
*/
public function testCreateHeader($expected, $header, $moduleId) {
-
$em = $this->createMock(IEncryptionModule::class);
$em->expects($this->any())->method('getId')->willReturn($moduleId);
@@ -101,7 +99,7 @@ class UtilTest extends TestCase {
$this->expectException(\OC\Encryption\Exceptions\EncryptionHeaderKeyExistsException::class);
- $header = array('header1' => 1, 'header2' => 2, 'oc_encryption_module' => 'foo');
+ $header = ['header1' => 1, 'header2' => 2, 'oc_encryption_module' => 'foo'];
$em = $this->createMock(IEncryptionModule::class);
$em->expects($this->any())->method('getId')->willReturn('moduleId');
@@ -120,7 +118,7 @@ class UtilTest extends TestCase {
$this->userManager
->expects($this->any())
->method('userExists')
- ->will($this->returnCallback(array($this, 'isExcludedCallback')));
+ ->willReturnCallback([$this, 'isExcludedCallback']);
$this->assertSame($expected,
$this->util->isExcluded($path)
@@ -128,17 +126,17 @@ class UtilTest extends TestCase {
}
public function providePathsForTestIsExcluded() {
- return array(
- array('/files_encryption', '', true),
- array('files_encryption/foo.txt', '', true),
- array('test/foo.txt', '', false),
- array('/user1/files_encryption/foo.txt', '', true),
- array('/user1/files/foo.txt', '', false),
- array('/keyStorage/user1/files/foo.txt', 'keyStorage', true),
- array('/keyStorage/files_encryption', '/keyStorage', true),
- array('keyStorage/user1/files_encryption', '/keyStorage/', true),
+ return [
+ ['/files_encryption', '', true],
+ ['files_encryption/foo.txt', '', true],
+ ['test/foo.txt', '', false],
+ ['/user1/files_encryption/foo.txt', '', true],
+ ['/user1/files/foo.txt', '', false],
+ ['/keyStorage/user1/files/foo.txt', 'keyStorage', true],
+ ['/keyStorage/files_encryption', '/keyStorage', true],
+ ['keyStorage/user1/files_encryption', '/keyStorage/', true],
- );
+ ];
}
public function isExcludedCallback() {
@@ -160,15 +158,15 @@ class UtilTest extends TestCase {
}
public function dataTestIsFile() {
- return array(
- array('/user/files/test.txt', true),
- array('/user/files', true),
- array('/user/files_versions/test.txt', false),
- array('/user/foo/files/test.txt', false),
- array('/files/foo/files/test.txt', false),
- array('/user', false),
- array('/user/test.txt', false),
- );
+ return [
+ ['/user/files/test.txt', true],
+ ['/user/files', true],
+ ['/user/files_versions/test.txt', false],
+ ['/user/foo/files/test.txt', false],
+ ['/files/foo/files/test.txt', false],
+ ['/user', false],
+ ['/user/test.txt', false],
+ ];
}
/**
@@ -183,12 +181,11 @@ class UtilTest extends TestCase {
}
public function dataTestStripPartialFileExtension() {
- return array(
- array('/foo/test.txt', '/foo/test.txt'),
- array('/foo/test.txt.part', '/foo/test.txt'),
- array('/foo/test.txt.ocTransferId7567846853.part', '/foo/test.txt'),
- array('/foo/test.txt.ocTransferId7567.part', '/foo/test.txt'),
- );
+ return [
+ ['/foo/test.txt', '/foo/test.txt'],
+ ['/foo/test.txt.part', '/foo/test.txt'],
+ ['/foo/test.txt.ocTransferId7567846853.part', '/foo/test.txt'],
+ ['/foo/test.txt.ocTransferId7567.part', '/foo/test.txt'],
+ ];
}
-
}