Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-04-01 10:08:50 +0300
committerThomas Müller <thomas.mueller@tmit.eu>2016-04-01 10:08:50 +0300
commit193a33a8ada641bb83f789da14b87f29230e0e3a (patch)
tree52573f5ce0224aac6347688c72d5678709e9cbc0 /tests
parentb84746ce36424615aef91e49a5977fc9d15a17c7 (diff)
parentd16553d2d8f651e1c3ba8cc60df52558cb253983 (diff)
Merge pull request #23709 from owncloud/stable9-make-sure-that-encrypted-version-is-set
[stable9] Make sure that the encrypted version is set
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/files/storage/wrapper/encryption.php24
1 files changed, 19 insertions, 5 deletions
diff --git a/tests/lib/files/storage/wrapper/encryption.php b/tests/lib/files/storage/wrapper/encryption.php
index 9d68f3b14b2..651299a3eab 100644
--- a/tests/lib/files/storage/wrapper/encryption.php
+++ b/tests/lib/files/storage/wrapper/encryption.php
@@ -260,25 +260,39 @@ class Encryption extends Storage {
$this->invokePrivate($this->instance, 'unencryptedSize', [[$path => $storedUnencryptedSize]]);
}
-
+ $fileEntry = $this->getMockBuilder('\OC\Files\Cache\Cache')
+ ->disableOriginalConstructor()->getMock();
$sourceStorage->expects($this->once())->method('getMetaData')->with($path)
->willReturn($metaData);
+ $sourceStorage->expects($this->any())
+ ->method('getCache')
+ ->with($path)
+ ->willReturn($fileEntry);
+ $fileEntry->expects($this->any())
+ ->method('get')
+ ->with($metaData['fileid']);
$this->instance->expects($this->any())->method('getCache')->willReturn($cache);
$this->instance->expects($this->any())->method('verifyUnencryptedSize')
->with($path, 0)->willReturn($expected['size']);
$result = $this->instance->getMetaData($path);
- $this->assertSame($expected['encrypted'], $result['encrypted']);
+ if(isset($expected['encrypted'])) {
+ $this->assertSame($expected['encrypted'], (bool)$result['encrypted']);
+
+ if(isset($expected['encryptedVersion'])) {
+ $this->assertSame($expected['encryptedVersion'], $result['encryptedVersion']);
+ }
+ }
$this->assertSame($expected['size'], $result['size']);
}
public function dataTestGetMetaData() {
return [
- ['/test.txt', ['size' => 42, 'encrypted' => false], true, true, 12, ['size' => 12, 'encrypted' => true]],
+ ['/test.txt', ['size' => 42, 'encrypted' => 2, 'encryptedVersion' => 2, 'fileid' => 1], true, true, 12, ['size' => 12, 'encrypted' => true, 'encryptedVersion' => 2]],
['/test.txt', null, true, true, 12, null],
- ['/test.txt', ['size' => 42, 'encrypted' => false], false, false, 12, ['size' => 42, 'encrypted' => false]],
- ['/test.txt', ['size' => 42, 'encrypted' => false], true, false, 12, ['size' => 12, 'encrypted' => true]]
+ ['/test.txt', ['size' => 42, 'encrypted' => 0, 'fileid' => 1], false, false, 12, ['size' => 42, 'encrypted' => false]],
+ ['/test.txt', ['size' => 42, 'encrypted' => false, 'fileid' => 1], true, false, 12, ['size' => 12, 'encrypted' => true]]
];
}