You are here

protected function EntityViewBuilderTest::createTestEntity in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Entity/EntityViewBuilderTest.php \Drupal\system\Tests\Entity\EntityViewBuilderTest::createTestEntity()

Creates an entity for testing.

Parameters

string $entity_type: The entity type.

Return value

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

4 calls to EntityViewBuilderTest::createTestEntity()
EntityViewBuilderTest::testEntityViewBuilderCache in core/modules/system/src/Tests/Entity/EntityViewBuilderTest.php
Tests entity render cache handling.
EntityViewBuilderTest::testEntityViewBuilderCacheToggling in core/modules/system/src/Tests/Entity/EntityViewBuilderTest.php
Tests entity render cache toggling.
EntityViewBuilderTest::testEntityViewBuilderCacheWithReferences in core/modules/system/src/Tests/Entity/EntityViewBuilderTest.php
Tests entity render cache with references.
EntityViewBuilderTest::testEntityViewBuilderWeight in core/modules/system/src/Tests/Entity/EntityViewBuilderTest.php
Tests weighting of display components.

File

core/modules/system/src/Tests/Entity/EntityViewBuilderTest.php, line 209
Contains \Drupal\system\Tests\Entity\EntityViewBuilderTest.

Class

EntityViewBuilderTest
Tests the entity view builder.

Namespace

Drupal\system\Tests\Entity

Code

protected function createTestEntity($entity_type) {
  $data = array(
    'bundle' => $entity_type,
    'name' => $this
      ->randomMachineName(),
  );
  return $this->container
    ->get('entity.manager')
    ->getStorage($entity_type)
    ->create($data);
}