Skip to content

Commit

Permalink
Merge pull request #24961 from nextcloud/bugfix/noid/copy-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusknorr authored Jan 5, 2021
2 parents 50b380e + 98560c8 commit 9b9c1aa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/private/Files/Storage/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -689,9 +689,9 @@ public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $t
$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;
Expand Down
5 changes: 3 additions & 2 deletions tests/lib/Files/ViewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
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;
Expand Down Expand Up @@ -1163,11 +1164,11 @@ private function doTestCopyRenameFail($operation) {
/** @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');
Expand Down

0 comments on commit 9b9c1aa

Please sign in to comment.