File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -86,7 +86,9 @@ public function time()
8686 */
8787 public function rename ($ toFilename )
8888 {
89- return $ this ->adapter ->rename ($ this ->path , $ toFilename );
89+ return $ this ->adapter ->rename ($ this ->path , $ toFilename )->then (function () use ($ toFilename ) {
90+ return $ this ->filesystem ->file ($ toFilename );
91+ });
9092 }
9193
9294 /**
Original file line number Diff line number Diff line change 22
33namespace React \Tests \Filesystem \Node ;
44
5+ use React \EventLoop \Factory ;
56use React \Filesystem \Filesystem ;
67use React \Filesystem \Node \Directory ;
78use React \Filesystem \Node \File ;
@@ -58,16 +59,17 @@ public function testRename()
5859 $ pathFrom = 'foo.bar ' ;
5960 $ pathTo = 'bar.foo ' ;
6061 $ filesystem = $ this ->mockAdapter ();
61- $ promise = $ this ->getMock ('React\Promise\PromiseInterface ' );
6262
6363 $ filesystem
6464 ->expects ($ this ->once ())
6565 ->method ('rename ' )
6666 ->with ($ pathFrom , $ pathTo )
67- ->will ($ this ->returnValue ($ promise ))
67+ ->will ($ this ->returnValue (new FulfilledPromise () ))
6868 ;
6969
70- $ this ->assertSame ($ promise , (new File ($ pathFrom , Filesystem::createFromAdapter ($ filesystem )))->rename ($ pathTo ));
70+ $ newFile = \Clue \React \Block \await ((new File ($ pathFrom , Filesystem::createFromAdapter ($ filesystem )))->rename ($ pathTo ), Factory::create ());
71+ $ this ->assertInstanceOf ('React\Filesystem\Node\FileInterface ' , $ newFile );
72+ $ this ->assertSame ($ pathTo , $ newFile ->getPath ());
7173 }
7274
7375 public function testExists ()
You can’t perform that action at this time.
0 commit comments