StreamedWritingPolyfillTests.php 899 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace League\Flysystem\Adapter;
  3. use League\Flysystem\Config;
  4. use League\Flysystem\Stub\StreamedWritingStub;
  5. use PHPUnit\Framework\TestCase;
  6. class StreamedWritingPolyfillTests extends TestCase
  7. {
  8. public function testWrite()
  9. {
  10. $stream = tmpfile();
  11. fwrite($stream, 'contents');
  12. $stub = new StreamedWritingStub();
  13. $response = $stub->writeStream('path.txt', $stream, new Config());
  14. $this->assertEquals(['path' => 'path.txt', 'contents' => 'contents'], $response);
  15. fclose($stream);
  16. }
  17. public function testUpdate()
  18. {
  19. $stream = tmpfile();
  20. fwrite($stream, 'contents');
  21. $stub = new StreamedWritingStub();
  22. $response = $stub->updateStream('path.txt', $stream, new Config());
  23. $this->assertEquals(['path' => 'path.txt', 'contents' => 'contents'], $response);
  24. fclose($stream);
  25. }
  26. }