function TermTranslationTest::testTermsTranslation
Same name in other branches
- 9 core/modules/taxonomy/tests/src/Functional/TermTranslationTest.php \Drupal\Tests\taxonomy\Functional\TermTranslationTest::testTermsTranslation()
- 8.9.x core/modules/taxonomy/tests/src/Functional/TermTranslationTest.php \Drupal\Tests\taxonomy\Functional\TermTranslationTest::testTermsTranslation()
- 11.x core/modules/taxonomy/tests/src/Functional/TermTranslationTest.php \Drupal\Tests\taxonomy\Functional\TermTranslationTest::testTermsTranslation()
Tests translation of terms are showed in the node.
File
-
core/
modules/ taxonomy/ tests/ src/ Functional/ TermTranslationTest.php, line 97
Class
- TermTranslationTest
- Tests for proper breadcrumb translation.
Namespace
Drupal\Tests\taxonomy\FunctionalCode
public function testTermsTranslation() : void {
// Set the display of the term reference field on the article content type
// to "Check boxes/radio buttons".
\Drupal::service('entity_display.repository')->getFormDisplay('node', 'article')
->setComponent($this->termFieldName, [
'type' => 'options_buttons',
])
->save();
$this->drupalLogin($this->drupalCreateUser([
'create article content',
]));
// Test terms are listed.
$this->drupalGet('node/add/article');
$this->assertSession()
->pageTextContains('one');
$this->assertSession()
->pageTextContains('two');
$this->assertSession()
->pageTextContains('three');
// Test terms translated are listed.
$this->drupalGet('hu/node/add/article');
$this->assertSession()
->pageTextContains('translatedOne');
$this->assertSession()
->pageTextContains('translatedTwo');
$this->assertSession()
->pageTextContains('translatedThree');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.