You are here

protected function TermCacheTagsTest::createEntity in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/taxonomy/src/Tests/TermCacheTagsTest.php \Drupal\taxonomy\Tests\TermCacheTagsTest::createEntity()

Creates the entity to be tested.

Return value

\Drupal\Core\Entity\EntityInterface The entity to be tested.

Overrides EntityCacheTagsTestBase::createEntity

File

core/modules/taxonomy/src/Tests/TermCacheTagsTest.php, line 27
Contains \Drupal\taxonomy\Tests\TermCacheTagsTest.

Class

TermCacheTagsTest
Tests the Taxonomy term entity's cache tags.

Namespace

Drupal\taxonomy\Tests

Code

protected function createEntity() {

  // Create a "Camelids" vocabulary.
  $vocabulary = entity_create('taxonomy_vocabulary', array(
    'name' => 'Camelids',
    'vid' => 'camelids',
  ));
  $vocabulary
    ->save();

  // Create a "Llama" taxonomy term.
  $term = entity_create('taxonomy_term', array(
    'name' => 'Llama',
    'vid' => $vocabulary
      ->id(),
  ));
  $term
    ->save();
  return $term;
}