diff --git a/composer.json b/composer.json index 99a3cd389..e67ab457e 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,8 @@ "google/cloud-storage": "^1.23", "async-aws/s3": "^1.5 || ^2.0", "async-aws/simple-s3": "^1.1 || ^2.0", - "sabre/dav": "^4.6.0" + "sabre/dav": "^4.6.0", + "guzzlehttp/psr7": "^2.6" }, "conflict": { "async-aws/core": "<1.19.0", diff --git a/src/FilesystemTest.php b/src/FilesystemTest.php index 9e484108d..26768e91e 100644 --- a/src/FilesystemTest.php +++ b/src/FilesystemTest.php @@ -7,6 +7,8 @@ use DateTimeImmutable; use DateTimeInterface; use Generator; +use GuzzleHttp\Psr7\StreamWrapper; +use GuzzleHttp\Psr7\Utils; use IteratorAggregate; use League\Flysystem\InMemory\InMemoryFilesystemAdapter; use League\Flysystem\Local\LocalFilesystemAdapter; @@ -98,6 +100,21 @@ public function writing_and_reading_a_stream(): void fclose($readStream); } + /** + * @test + */ + public function writing_using_a_stream_wrapper(): void + { + $contents = 'contents of the file'; + $stream = Utils::streamFor($contents); + $resource = StreamWrapper::getResource($stream); + + $this->filesystem->writeStream('from-stream-wrapper.txt', $resource); + fclose($resource); + + $this->assertEquals($contents, $this->filesystem->read('from-stream-wrapper.txt')); + } + /** * @test */