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)
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 ),
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments