aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2021-01-05 15:49:16 +0100
committerGitHub <noreply@github.com>2021-01-05 15:49:16 +0100
commit9b9c1aa7fd643747cd423d40c9c82ffa74e9e452 (patch)
treed9161c2b2f176de5125efeb4a74a6ee4f3378754
parent50b380e85b46f37de3612e4aa077726e8da94d01 (diff)
parent98560c80ea18df3629f374caa036221dadcb25f2 (diff)
downloadnextcloud-server-9b9c1aa7fd643747cd423d40c9c82ffa74e9e452.tar.gz
nextcloud-server-9b9c1aa7fd643747cd423d40c9c82ffa74e9e452.zip
Merge pull request #24961 from nextcloud/bugfix/noid/copy-tests
-rw-r--r--lib/private/Files/Storage/Common.php4
-rw-r--r--tests/lib/Files/ViewTest.php5
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php
index bddb1f4a294..aa2aeee403b 100644
--- a/lib/private/Files/Storage/Common.php
+++ b/lib/private/Files/Storage/Common.php
@@ -689,9 +689,9 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage {
$result = $this->copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath, true);
if ($result) {
if ($sourceStorage->is_dir($sourceInternalPath)) {
- $result &= $sourceStorage->rmdir($sourceInternalPath);
+ $result = $result && $sourceStorage->rmdir($sourceInternalPath);
} else {
- $result &= $sourceStorage->unlink($sourceInternalPath);
+ $result = $result && $sourceStorage->unlink($sourceInternalPath);
}
}
return $result;
diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php
index f18af484f87..eed8bca957f 100644
--- a/tests/lib/Files/ViewTest.php
+++ b/tests/lib/Files/ViewTest.php
@@ -17,6 +17,7 @@ use OC\Files\View;
use OCP\Constants;
use OCP\Files\Config\IMountProvider;
use OCP\Files\FileInfo;
+use OCP\Files\GenericFileException;
use OCP\Files\Storage\IStorage;
use OCP\Lock\ILockingProvider;
use OCP\Lock\LockedException;
@@ -1163,11 +1164,11 @@ class ViewTest extends \Test\TestCase {
/** @var \PHPUnit\Framework\MockObject\MockObject|Temporary $storage2 */
$storage2 = $this->getMockBuilder(TemporaryNoCross::class)
->setConstructorArgs([[]])
- ->setMethods(['fopen'])
+ ->setMethods(['fopen', 'writeStream'])
->getMock();
$storage2->method('writeStream')
- ->willReturn(0);
+ ->willThrowException(new GenericFileException("Failed to copy stream"));
$storage1->mkdir('sub');
$storage1->file_put_contents('foo.txt', '0123456789ABCDEFGH');