function StreamFileUploaderTest::testWriteStreamToFileWithSmallerBytes
Same name in other branches
- 11.x core/modules/file/tests/src/Kernel/Upload/StreamFileUploaderTest.php \Drupal\Tests\file\Kernel\Upload\StreamFileUploaderTest::testWriteStreamToFileWithSmallerBytes()
@covers ::writeStreamToFile
File
-
core/
modules/ file/ tests/ src/ Kernel/ Upload/ StreamFileUploaderTest.php, line 42
Class
- StreamFileUploaderTest
- Tests the stream file uploader.
Namespace
Drupal\Tests\file\Kernel\UploadCode
public function testWriteStreamToFileWithSmallerBytes() : void {
$content = $this->randomString(2048);
vfsStream::newFile('foo.txt')->at($this->vfsRoot)
->withContent($content);
$fileWriter = $this->container
->get('file.input_stream_file_writer');
$filename = $fileWriter->writeStreamToFile(stream: vfsStream::url('root/foo.txt'), bytesToRead: 1024);
$this->assertStringStartsWith('temporary://', $filename);
$this->assertStringEqualsFile($filename, $content);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.