@@ -824,6 +824,58 @@ public function copying_a_file_with_collision(): void
824824 });
825825 }
826826
827+ /**
828+ * @test
829+ */
830+ public function moving_a_file_with_collision (): void
831+ {
832+ $ this ->runScenario (function () {
833+ $ adapter = $ this ->adapter ();
834+ $ adapter ->write ('path.txt ' , 'new contents ' , new Config ());
835+ $ adapter ->write ('new-path.txt ' , 'contents ' , new Config ());
836+
837+ $ adapter ->move ('path.txt ' , 'new-path.txt ' , new Config ());
838+
839+ $ oldFileExists = $ adapter ->fileExists ('path.txt ' );
840+ $ this ->assertFalse ($ oldFileExists );
841+
842+ $ contents = $ adapter ->read ('new-path.txt ' );
843+ $ this ->assertEquals ('new contents ' , $ contents );
844+ });
845+ }
846+
847+ /**
848+ * @test
849+ */
850+ public function copying_a_file_with_same_destination (): void
851+ {
852+ $ this ->runScenario (function () {
853+ $ adapter = $ this ->adapter ();
854+ $ adapter ->write ('path.txt ' , 'new contents ' , new Config ());
855+
856+ $ adapter ->copy ('path.txt ' , 'path.txt ' , new Config ());
857+ $ contents = $ adapter ->read ('path.txt ' );
858+
859+ $ this ->assertEquals ('new contents ' , $ contents );
860+ });
861+ }
862+
863+ /**
864+ * @test
865+ */
866+ public function moving_a_file_with_same_destination (): void
867+ {
868+ $ this ->runScenario (function () {
869+ $ adapter = $ this ->adapter ();
870+ $ adapter ->write ('path.txt ' , 'new contents ' , new Config ());
871+
872+ $ adapter ->move ('path.txt ' , 'path.txt ' , new Config ());
873+
874+ $ contents = $ adapter ->read ('path.txt ' );
875+ $ this ->assertEquals ('new contents ' , $ contents );
876+ });
877+ }
878+
827879 protected function assertFileExistsAtPath (string $ path ): void
828880 {
829881 $ this ->runScenario (function () use ($ path ) {
0 commit comments