Skip to content

Commit 0f395d8

Browse files
authored
Merge pull request #24976 from nextcloud/backport/24961/stable20
[stable20] Fix unreliable ViewTest
2 parents 2dbf407 + 8d9fa73 commit 0f395d8

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

lib/private/Files/Storage/Common.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,9 +688,9 @@ public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $t
688688
$result = $this->copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath, true);
689689
if ($result) {
690690
if ($sourceStorage->is_dir($sourceInternalPath)) {
691-
$result &= $sourceStorage->rmdir($sourceInternalPath);
691+
$result = $result && $sourceStorage->rmdir($sourceInternalPath);
692692
} else {
693-
$result &= $sourceStorage->unlink($sourceInternalPath);
693+
$result = $result && $sourceStorage->unlink($sourceInternalPath);
694694
}
695695
}
696696
return $result;

tests/lib/Files/ViewTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use OCP\Constants;
1818
use OCP\Files\Config\IMountProvider;
1919
use OCP\Files\FileInfo;
20+
use OCP\Files\GenericFileException;
2021
use OCP\Files\Storage\IStorage;
2122
use OCP\Lock\ILockingProvider;
2223
use OCP\Lock\LockedException;
@@ -1163,11 +1164,11 @@ private function doTestCopyRenameFail($operation) {
11631164
/** @var \PHPUnit\Framework\MockObject\MockObject|Temporary $storage2 */
11641165
$storage2 = $this->getMockBuilder(TemporaryNoCross::class)
11651166
->setConstructorArgs([[]])
1166-
->setMethods(['fopen'])
1167+
->setMethods(['fopen', 'writeStream'])
11671168
->getMock();
11681169

11691170
$storage2->method('writeStream')
1170-
->willReturn(0);
1171+
->willThrowException(new GenericFileException("Failed to copy stream"));
11711172

11721173
$storage1->mkdir('sub');
11731174
$storage1->file_put_contents('foo.txt', '0123456789ABCDEFGH');

0 commit comments

Comments
 (0)