protected function ContentTranslationContextualLinksTest::setUp in Drupal 8
Same name in this branch
- 8 core/modules/content_translation/tests/src/Functional/ContentTranslationContextualLinksTest.php \Drupal\Tests\content_translation\Functional\ContentTranslationContextualLinksTest::setUp()
- 8 core/modules/content_translation/tests/src/FunctionalJavascript/ContentTranslationContextualLinksTest.php \Drupal\Tests\content_translation\FunctionalJavascript\ContentTranslationContextualLinksTest::setUp()
Same name and namespace in other branches
- 9 core/modules/content_translation/tests/src/Functional/ContentTranslationContextualLinksTest.php \Drupal\Tests\content_translation\Functional\ContentTranslationContextualLinksTest::setUp()
- 10 core/modules/content_translation/tests/src/Functional/ContentTranslationContextualLinksTest.php \Drupal\Tests\content_translation\Functional\ContentTranslationContextualLinksTest::setUp()
Overrides BrowserTestBase::setUp
File
- core/
modules/ content_translation/ tests/ src/ Functional/ ContentTranslationContextualLinksTest.php, line 64
Class
- ContentTranslationContextualLinksTest
- Tests that contextual links are available for content translation.
Namespace
Drupal\Tests\content_translation\FunctionalCode
protected function setUp() {
parent::setUp();
// Set up an additional language.
$this->langcodes = [
\Drupal::languageManager()
->getDefaultLanguage()
->getId(),
'es',
];
ConfigurableLanguage::createFromLangcode('es')
->save();
// Create a content type.
$this->bundle = $this
->randomMachineName();
$this->contentType = $this
->drupalCreateContentType([
'type' => $this->bundle,
]);
// Add a field to the content type. The field is not yet translatable.
FieldStorageConfig::create([
'field_name' => 'field_test_text',
'entity_type' => 'node',
'type' => 'text',
'cardinality' => 1,
])
->save();
FieldConfig::create([
'entity_type' => 'node',
'field_name' => 'field_test_text',
'bundle' => $this->bundle,
'label' => 'Test text-field',
])
->save();
$this->container
->get('entity_display.repository')
->getFormDisplay('node', $this->bundle)
->setComponent('field_test_text', [
'type' => 'text_textfield',
'weight' => 0,
])
->save();
// Create a translator user.
$permissions = [
'access contextual links',
'administer nodes',
"edit any {$this->bundle} content",
'translate any entity',
];
$this->translator = $this
->drupalCreateUser($permissions);
}