Skip to content

Commit b88f977

Browse files
committed
Merge branch 'pr-35075' into 2.4-develop-prs
2 parents 795f9b6 + 2be3e5f commit b88f977

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

app/code/Magento/AwsS3/Driver/AwsS3.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,10 @@ public function getRealPath($path)
527527
*/
528528
public function rename($oldPath, $newPath, DriverInterface $targetDriver = null): bool
529529
{
530+
if ($oldPath === $newPath) {
531+
return true;
532+
}
533+
530534
try {
531535
$this->adapter->move(
532536
$this->normalizeRelativePath($oldPath, true),

app/code/Magento/AwsS3/Test/Unit/Driver/AwsS3Test.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,4 +496,21 @@ public function testCreateDirectory(): void
496496

497497
self::assertTrue($this->driver->createDirectory(self::URL . 'test/test2/'));
498498
}
499+
500+
public function testRename(): void
501+
{
502+
$this->adapterMock->expects(self::once())
503+
->method('move')
504+
->with('test/path', 'test/path2');
505+
506+
self::assertTrue($this->driver->rename('test/path', 'test/path2'));
507+
}
508+
509+
public function testRenameSameDestination(): void
510+
{
511+
$this->adapterMock->expects(self::never())
512+
->method('move');
513+
514+
self::assertTrue($this->driver->rename('test/path', 'test/path'));
515+
}
499516
}

0 commit comments

Comments
 (0)