diff options
author | Björn Schießle <bjoern@schiessle.org> | 2018-08-08 18:27:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-08 18:27:18 +0200 |
commit | 11e99859ef3a28d0124241a43a934f70b7c3ff3a (patch) | |
tree | a3d3f5c785157762815c09402c5bc1f9f94975dc /tests | |
parent | 6b1ba9cdaf3ce5d63e6e46bcbc677cf7933f5fb3 (diff) | |
parent | a9e22c5f1ccdc148d8ea8a1e2f5e8baac6f19e90 (diff) | |
download | nextcloud-server-11e99859ef3a28d0124241a43a934f70b7c3ff3a.tar.gz nextcloud-server-11e99859ef3a28d0124241a43a934f70b7c3ff3a.zip |
Merge pull request #10397 from nextcloud/encryption-s3-fix
make file cache updates more robust
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Files/Stream/EncryptionTest.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/lib/Files/Stream/EncryptionTest.php b/tests/lib/Files/Stream/EncryptionTest.php index 983428ee51d..d7a5554acfd 100644 --- a/tests/lib/Files/Stream/EncryptionTest.php +++ b/tests/lib/Files/Stream/EncryptionTest.php @@ -2,8 +2,10 @@ namespace Test\Files\Stream; +use OC\Files\Cache\CacheEntry; use OC\Files\View; use OC\Memcache\ArrayCache; +use OCP\Files\Cache\ICache; use OCP\IConfig; class EncryptionTest extends \Test\TestCase { @@ -26,6 +28,7 @@ class EncryptionTest extends \Test\TestCase { $header = []; $uid = ''; $this->encryptionModule = $this->buildMockModule(); + $cache = $this->createMock(ICache::class); $storage = $this->getMockBuilder('\OC\Files\Storage\Storage') ->disableOriginalConstructor()->getMock(); $encStorage = $this->getMockBuilder('\OC\Files\Storage\Wrapper\Encryption') @@ -49,6 +52,13 @@ class EncryptionTest extends \Test\TestCase { $util->expects($this->any()) ->method('getUidAndFilename') ->willReturn(['user1', $internalPath]); + $storage->expects($this->any())->method('getCache')->willReturn($cache); + $entry = new CacheEntry([ + 'fileid' => 5, + 'encryptedVersion' => 2, + ]); + $cache->expects($this->any())->method('get')->willReturn($entry ); + $cache->expects($this->any())->method('update')->with(5, ['encrypted' => 3, 'encryptedVersion' => 3]); return $wrapper::wrap($source, $internalPath, @@ -208,6 +218,7 @@ class EncryptionTest extends \Test\TestCase { public function testSeek() { $fileName = tempnam("/tmp", "FOO"); + $stream = $this->getStream($fileName, 'w+', 0); $this->assertEquals(6, fwrite($stream, 'foobar')); $this->assertEquals(0, fseek($stream, 3)); |