protected function TextPlainUnitTest::createEntity

Creates an entity of type $this->entity_type and bundle $this->bundle.

Parameters

array $values: (optional) Additional values to pass to entity_create().

Return value

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

1 call to TextPlainUnitTest::createEntity()
TextPlainUnitTest::testPlainText in drupal/core/modules/text/lib/Drupal/text/Tests/Formatter/TextPlainUnitTest.php
Tests text_plain formatter output.

File

drupal/core/modules/text/lib/Drupal/text/Tests/Formatter/TextPlainUnitTest.php, line 106
Contains \Drupal\text\Tests\Formatter\TextPlainUnitTest.

Class

TextPlainUnitTest
Tests the text_plain field formatter.

Namespace

Drupal\text\Tests\Formatter

Code

protected function createEntity($values = array()) {
  $info = entity_get_info($this->entity_type);
  $bundle_key = $info['entity_keys']['bundle'];
  $entity = entity_create($this->entity_type, $values + array(
    $bundle_key => $this->bundle,
  ));
  return $entity;
}