File tree Expand file tree Collapse file tree 2 files changed +4
-32
lines changed Expand file tree Collapse file tree 2 files changed +4
-32
lines changed Original file line number Diff line number Diff line change @@ -145,20 +145,15 @@ public function close()
145145 */
146146 public function getContents ()
147147 {
148- return $ this ->open ('r ' )->then (function ($ stream ) {
149- return Stream \buffer ($ stream );
150- });
148+ return $ this ->adapter ->getContents ($ this ->path );
151149 }
152150
153151 /**
154152 * {@inheritDoc}
155153 */
156154 public function putContents ($ contents )
157155 {
158- return $ this ->open ('cw ' )->then (function (WritableStreamInterface $ stream ) use ($ contents ) {
159- $ stream ->write ($ contents );
160- return $ this ->close ();
161- });
156+ return $ this ->adapter ->putContents ($ this ->path , $ contents );
162157 }
163158
164159 /**
Original file line number Diff line number Diff line change @@ -280,36 +280,13 @@ public function testGetContents()
280280
281281 $ filesystem = $ this ->mockAdapter ();
282282
283- $ filesystem
284- ->expects ($ this ->any ())
285- ->method ('stat ' )
286- ->with ($ path )
287- ->will ($ this ->returnValue (new FulfilledPromise ([
288- 'size ' => 1 ,
289- ])))
290- ;
291-
292- $ filesystem
293- ->expects ($ this ->once ())
294- ->method ('open ' )
295- ->with ($ path , 'r ' )
296- ->will ($ this ->returnValue (new FulfilledPromise ($ fd )))
297- ;
298-
299283 $ filesystem
300284 ->expects ($ this ->once ())
301- ->method ('read ' )
302- ->with ($ fd , 1 , 0 )
285+ ->method ('getContents ' )
286+ ->with ($ path )
303287 ->will ($ this ->returnValue (new FulfilledPromise ('a ' )))
304288 ;
305289
306- $ filesystem
307- ->expects ($ this ->once ())
308- ->method ('close ' )
309- ->with ($ fd )
310- ->will ($ this ->returnValue (new FulfilledPromise ()))
311- ;
312-
313290 $ getContentsPromise = (new File ($ path , Filesystem::createFromAdapter ($ filesystem )))->getContents ();
314291 $ this ->assertInstanceOf ('React\Promise\PromiseInterface ' , $ getContentsPromise );
315292 }
You can’t perform that action at this time.
0 commit comments