function WorkspacesContentModerationStateTest::createEntity

Creates an entity.

Parameters

string $entity_type_id: The entity type ID.

array $values: An array of values for the entity.

Return value

\Drupal\Core\Entity\EntityInterface The created entity.

Overrides WorkspaceTestTrait::createEntity

File

core/modules/content_moderation/tests/src/Kernel/WorkspacesContentModerationStateTest.php, line 320

Class

WorkspacesContentModerationStateTest
Tests that Workspaces and Content Moderation work together properly.

Namespace

Drupal\Tests\content_moderation\Kernel

Code

protected function createEntity($entity_type_id, $moderation_state = 'published', $create_workflow = TRUE) {
  $entity = $this->workspaceManager
    ->executeOutsideWorkspace(function () use ($entity_type_id, $moderation_state, $create_workflow) {
    return parent::createEntity($entity_type_id, $moderation_state, $create_workflow);
  });
  return $entity;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.