You are here

protected function FunctionalTestBase::createEntity in Entity Construction Kit (ECK) 8

Creates a new entity.

Parameters

string $entity_type: The entity type to be created.

array $values: An array of settings. Example: 'id' => 'foo'.

Return value

\Drupal\Core\Entity\EntityInterface A new entity.

3 calls to FunctionalTestBase::createEntity()
AccessTest::testEntityAccess in tests/src/Functional/AccessTest.php
Tests if access handling for created entities is handled correctly.
EckEntityTranslationTest::testDeleteEntityTranslation in tests/src/Functional/EckEntityTranslationTest.php
Test the delete process of ECK entity translations.
EckEntityTranslationTest::testEntityTranslation in tests/src/Functional/EckEntityTranslationTest.php
Test translating of ECK entities.

File

tests/src/Functional/FunctionalTestBase.php, line 183

Class

FunctionalTestBase
Provides common functionality for ECK functional tests.

Namespace

Drupal\Tests\eck\Functional

Code

protected function createEntity($entity_type, array $values) {
  $storage = $this->container
    ->get('entity_type.manager')
    ->getStorage($entity_type);
  $entity = $storage
    ->create($values);
  $entity
    ->save();
  return $entity;
}