File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -527,6 +527,10 @@ public function getRealPath($path)
527
527
*/
528
528
public function rename ($ oldPath , $ newPath , DriverInterface $ targetDriver = null ): bool
529
529
{
530
+ if ($ oldPath === $ newPath ) {
531
+ return true ;
532
+ }
533
+
530
534
try {
531
535
$ this ->adapter ->move (
532
536
$ this ->normalizeRelativePath ($ oldPath , true ),
Original file line number Diff line number Diff line change @@ -496,4 +496,21 @@ public function testCreateDirectory(): void
496
496
497
497
self ::assertTrue ($ this ->driver ->createDirectory (self ::URL . 'test/test2/ ' ));
498
498
}
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
+ }
499
516
}
You can’t perform that action at this time.
0 commit comments