@ -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));