You are here

protected function EntityViewBuilderTest::createTestEntity in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php \Drupal\KernelTests\Core\Entity\EntityViewBuilderTest::createTestEntity()

Creates an entity for testing.

Parameters

string $entity_type: The entity type.

Return value

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

6 calls to EntityViewBuilderTest::createTestEntity()
EntityViewBuilderTest::testEntityViewBuilderCache in core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php
Tests entity render cache handling.
EntityViewBuilderTest::testEntityViewBuilderCacheToggling in core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php
Tests entity render cache toggling.
EntityViewBuilderTest::testEntityViewBuilderCacheWithReferences in core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php
Tests entity render cache with references.
EntityViewBuilderTest::testEntityViewBuilderWeight in core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php
Tests weighting of display components.
EntityViewBuilderTest::testNoTemplate in core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php
Tests that viewing an entity without template does not specify #theme.

... See full list

File

core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php, line 315

Class

EntityViewBuilderTest
Tests the entity view builder.

Namespace

Drupal\KernelTests\Core\Entity

Code

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