protected function SpaceUsedTest::createFileWithSize in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/file/src/Tests/SpaceUsedTest.php \Drupal\file\Tests\SpaceUsedTest::createFileWithSize()
Creates a file with a given size.
Parameters
string $uri: URI of the file to create.
int $size: Size of the file.
int $uid: File owner ID.
int $status: Whether the file should be permanent or temporary.
Return value
\Drupal\Core\Entity\EntityInterface The file entity.
1 call to SpaceUsedTest::createFileWithSize()
- SpaceUsedTest::setUp in core/
modules/ file/ src/ Tests/ SpaceUsedTest.php - Performs setup tasks before each individual test method is run.
File
- core/
modules/ file/ src/ Tests/ SpaceUsedTest.php, line 45 - Contains \Drupal\file\Tests\SpaceUsedTest.
Class
- SpaceUsedTest
- Tests the spaceUsed() function.
Namespace
Drupal\file\TestsCode
protected function createFileWithSize($uri, $size, $uid, $status = FILE_STATUS_PERMANENT) {
file_put_contents($uri, $this
->randomMachineName($size));
$file = entity_create('file', array(
'uri' => $uri,
'uid' => $uid,
'status' => $status,
));
$file
->save();
return $file;
}