summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-06-26 11:26:40 +0200
committerJoas Schilling <nickvergessen@owncloud.com>2015-06-26 13:17:23 +0200
commit9b336765b69bf7b7e2cd67a824862411b249aa4d (patch)
treeced65aed0f0a9ba4ce764ced0da1691abf595eb9 /tests
parent6c3a4282e5f24b5914b8d1afa869d9595fb14261 (diff)
downloadnextcloud-server-9b336765b69bf7b7e2cd67a824862411b249aa4d.tar.gz
nextcloud-server-9b336765b69bf7b7e2cd67a824862411b249aa4d.zip
Correctly check if the real file exists, otherwise try the part file
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/files/storage/wrapper/encryption.php26
1 files changed, 18 insertions, 8 deletions
diff --git a/tests/lib/files/storage/wrapper/encryption.php b/tests/lib/files/storage/wrapper/encryption.php
index 175713de497..a10e95a3f8b 100644
--- a/tests/lib/files/storage/wrapper/encryption.php
+++ b/tests/lib/files/storage/wrapper/encryption.php
@@ -381,10 +381,12 @@ class Encryption extends \Test\Files\Storage\Storage {
/**
* @dataProvider dataTestGetHeader
- * @param $path
- * @param $strippedPath
+ *
+ * @param string $path
+ * @param bool $strippedPathExists
+ * @param string $strippedPath
*/
- public function testGetHeader($path, $strippedPath) {
+ public function testGetHeader($path, $strippedPathExists, $strippedPath) {
$sourceStorage = $this->getMockBuilder('\OC\Files\Storage\Storage')
->disableOriginalConstructor()->getMock();
@@ -409,17 +411,25 @@ class Encryption extends \Test\Files\Storage\Storage {
$util->expects($this->once())->method('stripPartialFileExtension')
->with($path)->willReturn($strippedPath);
- $sourceStorage->expects($this->once())->method('file_exists')
- ->with($strippedPath)->willReturn(false);
+ $sourceStorage->expects($this->at(0))
+ ->method('file_exists')
+ ->with($strippedPath)
+ ->willReturn($strippedPathExists);
+ $sourceStorage->expects($this->at(1))
+ ->method('file_exists')
+ ->with($strippedPathExists ? $strippedPath : $path)
+ ->willReturn(false);
$this->invokePrivate($instance, 'getHeader', [$path]);
}
public function dataTestGetHeader() {
return array(
- array('/foo/bar.txt', '/foo/bar.txt'),
- array('/foo/bar.txt.part', '/foo/bar.txt'),
- array('/foo/bar.txt.ocTransferId7437493.part', '/foo/bar.txt'),
+ array('/foo/bar.txt', false, '/foo/bar.txt'),
+ array('/foo/bar.txt.part', false, '/foo/bar.txt'),
+ array('/foo/bar.txt.ocTransferId7437493.part', false, '/foo/bar.txt'),
+ array('/foo/bar.txt.part', true, '/foo/bar.txt'),
+ array('/foo/bar.txt.ocTransferId7437493.part', true, '/foo/bar.txt'),
);
}
}