You are here

protected function EntityViewControllerTest::createTestEntity in Zircon Profile 8

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

Creates an entity for testing.

Parameters

string $entity_type: The entity type.

Return value

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

2 calls to EntityViewControllerTest::createTestEntity()
EntityViewControllerTest::setUp in core/modules/system/src/Tests/Entity/EntityViewControllerTest.php
Sets up a Drupal site for running functional and integration tests.
EntityViewControllerTest::testEntityViewControllerViewBuilder in core/modules/system/src/Tests/Entity/EntityViewControllerTest.php
Tests that a view builder can successfully override the view builder.

File

core/modules/system/src/Tests/Entity/EntityViewControllerTest.php, line 134
Contains \Drupal\system\Tests\Entity\EntityViewControllerTest.

Class

EntityViewControllerTest
Tests EntityViewController functionality.

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);
}