summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2021-09-07 11:52:08 +0200
committerGitHub <noreply@github.com>2021-09-07 11:52:08 +0200
commit00c2aa5dada374988f3ef08a0064a8ab9115ada2 (patch)
tree3c0a593a21cec190df143ce3fe21043e8ce64747 /tests
parent7dece11af05e7a2d41db919a8dee855f77ac915e (diff)
parentbb092dd7cc711dadab7ee62e3e225c308725c160 (diff)
downloadnextcloud-server-00c2aa5dada374988f3ef08a0064a8ab9115ada2.tar.gz
nextcloud-server-00c2aa5dada374988f3ef08a0064a8ab9115ada2.zip
Merge pull request #27406 from nextcloud/backport/24966/stable21
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Files/Storage/Wrapper/EncryptionTest.php18
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php
index 8bdb48fd854..a4ee5e45bd5 100644
--- a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php
+++ b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php
@@ -584,6 +584,14 @@ class EncryptionTest extends Storage {
$this->arrayCache
]
)->getMock();
+
+ $cache = $this->getMockBuilder('\OC\Files\Cache\Cache')
+ ->disableOriginalConstructor()->getMock();
+ $cache->expects($this->any())
+ ->method('get')
+ ->willReturnCallback(function ($path) {
+ return ['encrypted' => true, 'path' => $path];
+ });
$instance = $this->getMockBuilder('\OC\Files\Storage\Wrapper\Encryption')
->setConstructorArgs(
@@ -597,9 +605,11 @@ class EncryptionTest extends Storage {
$this->encryptionManager, $util, $this->logger, $this->file, null, $this->keyStore, $this->update, $this->mountManager, $this->arrayCache
]
)
- ->setMethods(['readFirstBlock', 'parseRawHeader'])
+ ->setMethods(['getCache','readFirstBlock', 'parseRawHeader'])
->getMock();
-
+
+ $instance->expects($this->once())->method('getCache')->willReturn($cache);
+
$instance->expects($this->once())->method(('parseRawHeader'))
->willReturn([Util::HEADER_ENCRYPTION_MODULE_KEY => 'OC_DEFAULT_MODULE']);
@@ -677,8 +687,8 @@ class EncryptionTest extends Storage {
->setMethods(['readFirstBlock', 'parseRawHeader', 'getCache'])
->getMock();
- $instance->expects($this->once())->method(('parseRawHeader'))->willReturn($header);
- $instance->expects($this->any())->method('getCache')->willReturn($cache);
+ $instance->expects($this->any())->method(('parseRawHeader'))->willReturn($header);
+ $instance->expects($this->once())->method('getCache')->willReturn($cache);
$result = $this->invokePrivate($instance, 'getHeader', ['test.txt']);
$this->assertSameSize($expected, $result);