summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2019-11-22 09:52:58 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2019-11-27 13:34:42 +0100
commitef4b59d3417ff9069425d7ae7a8e6e4f8165f7fb (patch)
tree3bf7113c1730cce86c15155a96adc89e3835d3bf /tests
parent799f58391ea1dca3a24abe2598e08692af2a2c0b (diff)
downloadnextcloud-server-ef4b59d3417ff9069425d7ae7a8e6e4f8165f7fb.tar.gz
nextcloud-server-ef4b59d3417ff9069425d7ae7a8e6e4f8165f7fb.zip
More fixes
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'tests')
-rw-r--r--tests/Core/Controller/AvatarControllerTest.php2
-rw-r--r--tests/lib/Files/Storage/Wrapper/EncryptionTest.php21
-rw-r--r--tests/lib/Session/CryptoWrappingTest.php3
3 files changed, 19 insertions, 7 deletions
diff --git a/tests/Core/Controller/AvatarControllerTest.php b/tests/Core/Controller/AvatarControllerTest.php
index e43196824c1..d7feec28fd2 100644
--- a/tests/Core/Controller/AvatarControllerTest.php
+++ b/tests/Core/Controller/AvatarControllerTest.php
@@ -332,7 +332,7 @@ class AvatarControllerTest extends \Test\TestCase {
$this->cache->method('get')->willReturn(file_get_contents(\OC::$SERVERROOT.'/tests/data/testimage.gif'));
//Create request return
- $reqRet = ['error' => [0], 'tmp_name' => [$fileName], 'size' => filesize(\OC::$SERVERROOT.'/tests/data/testimage.gif')];
+ $reqRet = ['error' => [0], 'tmp_name' => [$fileName], 'size' => [filesize(\OC::$SERVERROOT.'/tests/data/testimage.gif')]];
$this->request->method('getUploadedFile')->willReturn($reqRet);
$response = $this->avatarController->postAvatar(null);
diff --git a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php
index eb43eb73359..95ee0ada24f 100644
--- a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php
+++ b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php
@@ -284,13 +284,17 @@ class EncryptionTest extends Storage {
->method('getCache')
->with($path)
->willReturn($fileEntry);
- $fileEntry->expects($this->any())
- ->method('get')
- ->with($metaData['fileid']);
+ if ($metaData !== null) {
+ $fileEntry->expects($this->any())
+ ->method('get')
+ ->with($metaData['fileid']);
+ }
$this->instance->expects($this->any())->method('getCache')->willReturn($cache);
- $this->instance->expects($this->any())->method('verifyUnencryptedSize')
- ->with($path, 0)->willReturn($expected['size']);
+ if ($expected !== null) {
+ $this->instance->expects($this->any())->method('verifyUnencryptedSize')
+ ->with($path, 0)->willReturn($expected['size']);
+ }
$result = $this->instance->getMetaData($path);
if(isset($expected['encrypted'])) {
@@ -300,7 +304,12 @@ class EncryptionTest extends Storage {
$this->assertSame($expected['encryptedVersion'], $result['encryptedVersion']);
}
}
- $this->assertSame($expected['size'], $result['size']);
+
+ if ($expected !== null) {
+ $this->assertSame($expected['size'], $result['size']);
+ } else {
+ $this->assertSame(null, $result);
+ }
}
public function dataTestGetMetaData() {
diff --git a/tests/lib/Session/CryptoWrappingTest.php b/tests/lib/Session/CryptoWrappingTest.php
index 493d16bfbfb..fac515c8f52 100644
--- a/tests/lib/Session/CryptoWrappingTest.php
+++ b/tests/lib/Session/CryptoWrappingTest.php
@@ -52,6 +52,9 @@ class CryptoWrappingTest extends TestCase {
$this->crypto->expects($this->any())
->method('decrypt')
->willReturnCallback(function ($input) {
+ if ($input === '') {
+ return '';
+ }
return substr($input, 1, -1);
});