diff options
author | Jasper Knockaert <jasper@knockaert.nl> | 2021-01-05 20:41:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-05 20:41:02 +0100 |
commit | 664e74a82ec957c44ea5ec782e2718546c534f87 (patch) | |
tree | 100e558c6b380ebabc524e7e7f5d91419aa360e5 /tests | |
parent | 87c640193bd9d2a6a4a29163ad0cb539f263cacc (diff) | |
download | nextcloud-server-664e74a82ec957c44ea5ec782e2718546c534f87.tar.gz nextcloud-server-664e74a82ec957c44ea5ec782e2718546c534f87.zip |
2nd attempt to fix tests
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Files/Storage/Wrapper/EncryptionTest.php | 18 |
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 ef524a55fda..6bdacda8c76 100644 --- a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php +++ b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php @@ -560,12 +560,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(); @@ -579,6 +573,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( @@ -594,7 +596,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']); |