protected function AssetTestBase::createAssetEntity in farmOS 2.x
Creates a asset entity.
Parameters
array $values: Array of values to feed the entity.
Return value
\Drupal\asset\Entity\AssetInterface The asset entity.
5 calls to AssetTestBase::createAssetEntity()
- AssetCRUDTest::testArchiveAsset in modules/
core/ asset/ tests/ src/ Functional/ AssetCRUDTest.php - Asset archiving.
- AssetCRUDTest::testArchiveAssetViaTimestamp in modules/
core/ asset/ tests/ src/ Functional/ AssetCRUDTest.php - Asset archiving/unarchiving via timestamp.
- AssetCRUDTest::testDeleteAsset in modules/
core/ asset/ tests/ src/ Functional/ AssetCRUDTest.php - Delete asset entity.
- AssetCRUDTest::testEditAsset in modules/
core/ asset/ tests/ src/ Functional/ AssetCRUDTest.php - Edit asset entity.
- AssetCRUDTest::testViewAsset in modules/
core/ asset/ tests/ src/ Functional/ AssetCRUDTest.php - Display asset entity.
File
- modules/
core/ asset/ tests/ src/ Functional/ AssetTestBase.php, line 72
Class
- AssetTestBase
- Tests the asset CRUD.
Namespace
Drupal\Tests\asset\FunctionalCode
protected function createAssetEntity(array $values = []) {
$storage = \Drupal::service('entity_type.manager')
->getStorage('asset');
$entity = $storage
->create($values + [
'name' => $this
->randomMachineName(),
'created' => \Drupal::time()
->getRequestTime(),
'type' => 'default',
]);
return $entity;
}