summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJasper Knockaert <jasper@knockaert.nl>2021-01-05 20:41:02 +0100
committerMichaIng (Rebase PR Action) <micha@dietpi.com>2021-09-03 13:40:41 +0000
commitbbf191bdef3bef110928cf24bfa3d0931002a1a4 (patch)
treeb6385d9b7c5ba14a23ff6f8bbd96321cbcf214fd /tests
parentab14c0322b0ea8f9b7ae827b91a7170b813ec78b (diff)
downloadnextcloud-server-bbf191bdef3bef110928cf24bfa3d0931002a1a4.tar.gz
nextcloud-server-bbf191bdef3bef110928cf24bfa3d0931002a1a4.zip
2nd attempt to fix tests
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Files/Storage/Wrapper/EncryptionTest.php18
1 files changed, 11 insertions, 7 deletions
diff --git a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php
index 2a2a45e53ce..7042fd09f5e 100644
--- a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php
+++ b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php
@@ -566,12 +566,6 @@ class EncryptionTest extends Storage {
* @param string $strippedPath
*/
public function testGetHeader($path, $strippedPathExists, $strippedPath) {
- $cache = $this->getMockBuilder('\OC\Files\Cache\Cache')
- ->disableOriginalConstructor()->getMock();
- $cache->expects($this->any())
- ->method('get')
- ->willReturn(['encrypted' => true]);
-
$sourceStorage = $this->getMockBuilder('\OC\Files\Storage\Storage')
->disableOriginalConstructor()->getMock();
@@ -590,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(
@@ -605,7 +607,9 @@ class EncryptionTest extends Storage {
)
->setMethods(['getCache','readFirstBlock', 'parseRawHeader'])
->getMock();
-
+
+ $instance->expects($this->any())->method('getCache')->willReturn($cache);
+
$instance->expects($this->once())->method(('parseRawHeader'))
->willReturn([Util::HEADER_ENCRYPTION_MODULE_KEY => 'OC_DEFAULT_MODULE']);