protected function ContentTranslationLinkTagTest::createTranslatableEntity in Drupal 9
Same name and namespace in other branches
- 8 core/modules/content_translation/tests/src/Functional/ContentTranslationLinkTagTest.php \Drupal\Tests\content_translation\Functional\ContentTranslationLinkTagTest::createTranslatableEntity()
- 10 core/modules/content_translation/tests/src/Functional/ContentTranslationLinkTagTest.php \Drupal\Tests\content_translation\Functional\ContentTranslationLinkTagTest::createTranslatableEntity()
Create a test entity with translations.
Return value
\Drupal\Core\Entity\EntityInterface An entity with translations.
1 call to ContentTranslationLinkTagTest::createTranslatableEntity()
- ContentTranslationLinkTagTest::testCanonicalAlternateTags in core/
modules/ content_translation/ tests/ src/ Functional/ ContentTranslationLinkTagTest.php - Tests alternate link tag found for entity types with canonical links.
File
- core/
modules/ content_translation/ tests/ src/ Functional/ ContentTranslationLinkTagTest.php, line 71
Class
- ContentTranslationLinkTagTest
- Tests whether canonical link tags are present for content entities.
Namespace
Drupal\Tests\content_translation\FunctionalCode
protected function createTranslatableEntity() {
$entity = EntityTestMul::create([
'label' => $this
->randomString(),
]);
// Create translations for non default languages.
foreach ($this->langcodes as $langcode) {
$entity
->addTranslation($langcode, [
'label' => $this
->randomString(),
]);
}
$entity
->save();
return $entity;
}