protected function TermCacheTagsTest::createEntity in Drupal 9
Same name and namespace in other branches
- 8 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\FunctionalCode
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;
}