protected function MediaTrait::createFile in Entity Reference Hierarchy 3.x
Same name and namespace in other branches
- 8.2 modules/entity_hierarchy_microsite/tests/src/Traits/MediaTrait.php \Drupal\Tests\entity_hierarchy_microsite\Traits\MediaTrait::createFile()
Creates a file entity.
Parameters
string $uri: The file uri.
int $status: The file status.
Return value
\Drupal\file\FileInterface The file entity.
1 call to MediaTrait::createFile()
- MediaTrait::createImageMedia in modules/
entity_hierarchy_microsite/ tests/ src/ Traits/ MediaTrait.php - Create an image media entity.
File
- modules/
entity_hierarchy_microsite/ tests/ src/ Traits/ MediaTrait.php, line 58
Class
- MediaTrait
- Defines a class for media utilties in tests.
Namespace
Drupal\Tests\entity_hierarchy_microsite\TraitsCode
protected function createFile($uri, $status = 1) {
$file = File::create([
'uri' => $uri,
'status' => $status,
]);
$file
->save();
return $file;
}