function 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 33

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.