File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -161,7 +161,7 @@ public function getStream(): StreamInterface
161161 }
162162
163163 if ($ this ->stream === null ) {
164- $ this ->stream = new Stream ($ this ->file );
164+ $ this ->stream = new Stream ($ this ->file , ' r+ ' );
165165 }
166166
167167 return $ this ->stream ;
Original file line number Diff line number Diff line change @@ -251,4 +251,13 @@ public function testMoveToThrowExceptionForTargetPathIsNotExist(): void
251251 $ this ->expectException (RuntimeException::class);
252252 $ uploadedFile ->moveTo ('path/to/not-exist ' );
253253 }
254+
255+ public function testGetStreamContentIfUploadedFileNotStream ()
256+ {
257+ file_put_contents ($ this ->tmpFile , $ content = 'Content ' );
258+ $ uploadedFile = new UploadedFile ($ this ->tmpFile , 1024 , UPLOAD_ERR_OK );
259+ $ this ->assertInstanceOf (StreamInterface::class, $ uploadedFile ->getStream ());
260+ $ this ->assertInstanceOf (Stream::class, $ uploadedFile ->getStream ());
261+ $ this ->assertSame ($ content , (string ) $ uploadedFile ->getStream ());
262+ }
254263}
You can’t perform that action at this time.
0 commit comments