Skip to content

Commit

Permalink
Added explicit test for writing using a stream-wrapper.
Browse files Browse the repository at this point in the history
  • Loading branch information
frankdejonge committed Apr 20, 2024
1 parent 7386ebd commit b744531
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion composer.json
Expand Up @@ -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",
Expand Down
17 changes: 17 additions & 0 deletions src/FilesystemTest.php
Expand Up @@ -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;
Expand Down Expand Up @@ -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
*/
Expand Down

0 comments on commit b744531

Please sign in to comment.