Merge pull request #24961 from nextcloud/bugfix/noid/copy-tests
This commit is contained in:
commit
9b9c1aa7fd
|
@ -689,9 +689,9 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage {
|
||||||
$result = $this->copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath, true);
|
$result = $this->copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath, true);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
if ($sourceStorage->is_dir($sourceInternalPath)) {
|
if ($sourceStorage->is_dir($sourceInternalPath)) {
|
||||||
$result &= $sourceStorage->rmdir($sourceInternalPath);
|
$result = $result && $sourceStorage->rmdir($sourceInternalPath);
|
||||||
} else {
|
} else {
|
||||||
$result &= $sourceStorage->unlink($sourceInternalPath);
|
$result = $result && $sourceStorage->unlink($sourceInternalPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
|
|
|
@ -17,6 +17,7 @@ use OC\Files\View;
|
||||||
use OCP\Constants;
|
use OCP\Constants;
|
||||||
use OCP\Files\Config\IMountProvider;
|
use OCP\Files\Config\IMountProvider;
|
||||||
use OCP\Files\FileInfo;
|
use OCP\Files\FileInfo;
|
||||||
|
use OCP\Files\GenericFileException;
|
||||||
use OCP\Files\Storage\IStorage;
|
use OCP\Files\Storage\IStorage;
|
||||||
use OCP\Lock\ILockingProvider;
|
use OCP\Lock\ILockingProvider;
|
||||||
use OCP\Lock\LockedException;
|
use OCP\Lock\LockedException;
|
||||||
|
@ -1163,11 +1164,11 @@ class ViewTest extends \Test\TestCase {
|
||||||
/** @var \PHPUnit\Framework\MockObject\MockObject|Temporary $storage2 */
|
/** @var \PHPUnit\Framework\MockObject\MockObject|Temporary $storage2 */
|
||||||
$storage2 = $this->getMockBuilder(TemporaryNoCross::class)
|
$storage2 = $this->getMockBuilder(TemporaryNoCross::class)
|
||||||
->setConstructorArgs([[]])
|
->setConstructorArgs([[]])
|
||||||
->setMethods(['fopen'])
|
->setMethods(['fopen', 'writeStream'])
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
$storage2->method('writeStream')
|
$storage2->method('writeStream')
|
||||||
->willReturn(0);
|
->willThrowException(new GenericFileException("Failed to copy stream"));
|
||||||
|
|
||||||
$storage1->mkdir('sub');
|
$storage1->mkdir('sub');
|
||||||
$storage1->file_put_contents('foo.txt', '0123456789ABCDEFGH');
|
$storage1->file_put_contents('foo.txt', '0123456789ABCDEFGH');
|
||||||
|
|
Loading…
Reference in New Issue