You are here

protected function TermCacheTagsTest::createEntity in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/taxonomy/tests/src/Functional/TermCacheTagsTest.php \Drupal\Tests\taxonomy\Functional\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/tests/src/Functional/TermCacheTagsTest.php, line 29

Class

TermCacheTagsTest
Tests the Taxonomy term entity's cache tags.

Namespace

Drupal\Tests\taxonomy\Functional

Code

protected function createEntity() {

  // Create a "Camelids" vocabulary.
  $vocabulary = Vocabulary::create([
    'name' => 'Camelids',
    'vid' => 'camelids',
  ]);
  $vocabulary
    ->save();

  // Create a "Llama" taxonomy term.
  $term = Term::create([
    'name' => 'Llama',
    'vid' => $vocabulary
      ->id(),
  ]);
  $term
    ->save();
  return $term;
}