function TermCacheTagsTest::createEntity

Same name in other branches
  1. 9 core/modules/taxonomy/tests/src/Functional/TermCacheTagsTest.php \Drupal\Tests\taxonomy\Functional\TermCacheTagsTest::createEntity()
  2. 10 core/modules/taxonomy/tests/src/Functional/TermCacheTagsTest.php \Drupal\Tests\taxonomy\Functional\TermCacheTagsTest::createEntity()
  3. 11.x core/modules/taxonomy/tests/src/Functional/TermCacheTagsTest.php \Drupal\Tests\taxonomy\Functional\TermCacheTagsTest::createEntity()

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

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