@@ -151,6 +151,17 @@ public function testGetContents(LoopInterface $loop, FilesystemInterface $filesy
151151 $ this ->assertSame ($ contents , $ fileContents );
152152 }
153153
154+ /**
155+ * @dataProvider filesystemProvider
156+ */
157+ public function testGetBinaryContents (LoopInterface $ loop , FilesystemInterface $ filesystem )
158+ {
159+ $ file = __DIR__ . DIRECTORY_SEPARATOR . 'reactphp-logo.png ' ;
160+ $ this ->assertFileExists ($ file );
161+ $ fileContents = $ this ->await ($ filesystem ->file ($ file )->getContents (), $ loop );
162+ $ this ->assertSame (file_get_contents ($ file ), $ fileContents );
163+ }
164+
154165 /**
155166 * @dataProvider filesystemProvider
156167 */
@@ -257,4 +268,16 @@ public function testPutContents(LoopInterface $loop, FilesystemInterface $filesy
257268 $ this ->assertFileExists ($ tempFile );
258269 $ this ->assertSame ($ contents , file_get_contents ($ tempFile ));
259270 }
271+ /**
272+ * @dataProvider filesystemProvider
273+ */
274+ public function testPutBinaryContents (LoopInterface $ loop , FilesystemInterface $ filesystem )
275+ {
276+ $ contents = file_get_contents (__DIR__ . DIRECTORY_SEPARATOR . 'reactphp-logo.png ' );
277+ $ filename = uniqid ('' , true );
278+ $ tempFile = $ this ->tmpDir . $ filename ;
279+ $ this ->await ($ filesystem ->file ($ tempFile )->putContents ($ contents ), $ loop );
280+ $ this ->assertFileExists ($ tempFile );
281+ $ this ->assertSame ($ contents , file_get_contents ($ tempFile ));
282+ }
260283}
0 commit comments