protected function TestBase::createEntity in Workbench Moderation to Content Moderation 8.2
Return value
\Drupal\Core\Entity\ContentEntityInterface
5 calls to TestBase::createEntity()
- TestBase::testMultipleRevisionsWithNewTranslation in tests/
src/ Functional/ TestBase.php - Migrates an entity with several revisions, one of which adds a translation.
- TestBase::testMultipleTranslatedMixedRevisions in tests/
src/ Functional/ TestBase.php - Migrates an entity with several revisions and translations.
- TestBase::testMultipleTranslatedRevisions in tests/
src/ Functional/ TestBase.php - Migrates an entity with several revisions, all of which are translated.
- TestBase::testMultipleUntranslatedRevisions in tests/
src/ Functional/ TestBase.php - Migrates an entity with several revisions, but no translations.
- TestBase::testSingleTranslatedRevision in tests/
src/ Functional/ TestBase.php - Migrates an entity with translations, but only one revision.
File
- tests/
src/ Functional/ TestBase.php, line 78
Class
Namespace
Drupal\Tests\wbm2cm\FunctionalCode
protected function createEntity() {
$values = [];
/** @var \Drupal\Core\Entity\EntityTypeInterface $entity_type */
$entity_type = $this->storage
->getEntityType();
if ($entity_type
->hasKey('bundle')) {
$values[$entity_type
->getKey('bundle')] = $this
->randomBundle();
}
if ($entity_type
->hasKey('label')) {
$values[$entity_type
->getKey('label')] = $this
->randomMachineName(16);
}
return $this->storage
->create($values);
}