diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-03-21 09:48:15 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-03-21 09:48:15 +0100 |
commit | fefaa1fd8736d270e007c697ad65e594bd4deb8f (patch) | |
tree | 9c5a5eec6008b8dfd6ef7e929c71d449dfa5075d /tests | |
parent | ce0f68c7ce45563a789cfeee3d2c6ebe73e65d57 (diff) | |
parent | f9ad57ee523db315e49f08ae4d28b592d32cc8c9 (diff) | |
download | nextcloud-server-fefaa1fd8736d270e007c697ad65e594bd4deb8f.tar.gz nextcloud-server-fefaa1fd8736d270e007c697ad65e594bd4deb8f.zip |
Merge pull request #23293 from owncloud/backport-23108
[stable9] Ensure that stored version is at least 1 for cross-storage copy
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/files/storage/wrapper/encryption.php | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/lib/files/storage/wrapper/encryption.php b/tests/lib/files/storage/wrapper/encryption.php index b5ec15b12bf..bde920e440e 100644 --- a/tests/lib/files/storage/wrapper/encryption.php +++ b/tests/lib/files/storage/wrapper/encryption.php @@ -672,6 +672,48 @@ class Encryption extends Storage { ]; } + public function testCopyBetweenStorageMinimumEncryptedVersion() { + $storage2 = $this->getMockBuilder('OCP\Files\Storage') + ->disableOriginalConstructor() + ->getMock(); + + $sourceInternalPath = $targetInternalPath = 'file.txt'; + $preserveMtime = $isRename = false; + + $storage2->expects($this->any()) + ->method('fopen') + ->willReturnCallback(function($path, $mode) { + $temp = \OC::$server->getTempManager(); + return fopen($temp->getTemporaryFile(), $mode); + }); + $cache = $this->getMock('\OCP\Files\Cache\ICache'); + $cache->expects($this->once()) + ->method('get') + ->with($sourceInternalPath) + ->willReturn(['encryptedVersion' => 0]); + $storage2->expects($this->once()) + ->method('getCache') + ->willReturn($cache); + $this->encryptionManager->expects($this->any()) + ->method('isEnabled') + ->willReturn(true); + global $mockedMountPointEncryptionEnabled; + $mockedMountPointEncryptionEnabled = true; + + $expectedCachePut = [ + 'encrypted' => true, + ]; + $expectedCachePut['encryptedVersion'] = 1; + + $this->cache->expects($this->once()) + ->method('put') + ->with($sourceInternalPath, $expectedCachePut); + + $this->invokePrivate($this->instance, 'copyBetweenStorage', [$storage2, $sourceInternalPath, $targetInternalPath, $preserveMtime, $isRename]); + + $this->assertFalse(false); + } + /** * @dataProvider dataCopyBetweenStorage * |