You are here

protected function RESTTestBase::entityCreate in Drupal 8

Creates entity objects based on their types.

Parameters

string $entity_type: The type of the entity that should be created.

Return value

\Drupal\Core\Entity\EntityInterface The new entity object.

File

core/modules/rest/src/Tests/RESTTestBase.php, line 291

Class

RESTTestBase
Test helper class that provides a REST client method to send HTTP requests.

Namespace

Drupal\rest\Tests

Code

protected function entityCreate($entity_type) {
  return $this->container
    ->get('entity_type.manager')
    ->getStorage($entity_type)
    ->create($this
    ->entityValues($entity_type));
}