diff options
author | Lukas Reschke <lukas@owncloud.com> | 2016-02-09 22:27:23 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2016-02-09 23:43:27 +0100 |
commit | 6724f765733fa67f6f3e3fd0fb6a6a23eaaa127b (patch) | |
tree | 7fee7e5b28f5ba74b8884c57bc832a4e2d78c420 /apps/encryption/tests | |
parent | 377d7fb8a817f337552e444c5aea9eb82bcfada4 (diff) | |
download | nextcloud-server-6724f765733fa67f6f3e3fd0fb6a6a23eaaa127b.tar.gz nextcloud-server-6724f765733fa67f6f3e3fd0fb6a6a23eaaa127b.zip |
Use cache and add tests
Diffstat (limited to 'apps/encryption/tests')
-rw-r--r-- | apps/encryption/tests/lib/KeyManagerTest.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/apps/encryption/tests/lib/KeyManagerTest.php b/apps/encryption/tests/lib/KeyManagerTest.php index c69610fb541..a8cb2dcc789 100644 --- a/apps/encryption/tests/lib/KeyManagerTest.php +++ b/apps/encryption/tests/lib/KeyManagerTest.php @@ -579,4 +579,31 @@ class KeyManagerTest extends TestCase { ]; } + public function testGetVersionWithoutFileInfo() { + $view = $this->getMockBuilder('\\OC\\Files\\View') + ->disableOriginalConstructor()->getMock(); + $view->expects($this->once()) + ->method('getFileInfo') + ->with('/admin/files/myfile.txt') + ->willReturn(false); + + $this->assertSame(0, $this->instance->getVersion('/admin/files/myfile.txt', $view)); + } + + public function testGetVersionWithFileInfo() { + $view = $this->getMockBuilder('\\OC\\Files\\View') + ->disableOriginalConstructor()->getMock(); + $fileInfo = $this->getMockBuilder('\\OC\\Files\\FileInfo') + ->disableOriginalConstructor()->getMock(); + $fileInfo->expects($this->once()) + ->method('getEncryptedVersion') + ->willReturn(1337); + $view->expects($this->once()) + ->method('getFileInfo') + ->with('/admin/files/myfile.txt') + ->willReturn($fileInfo); + + $this->assertSame(1337, $this->instance->getVersion('/admin/files/myfile.txt', $view)); + } + } |