protected function LingotekNodeMultivaluedFieldTest::setUp in Lingotek Translation 4.0.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/LingotekNodeMultivaluedFieldTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeMultivaluedFieldTest::setUp()
- 3.0.x tests/src/Functional/LingotekNodeMultivaluedFieldTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeMultivaluedFieldTest::setUp()
- 3.1.x tests/src/Functional/LingotekNodeMultivaluedFieldTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeMultivaluedFieldTest::setUp()
- 3.2.x tests/src/Functional/LingotekNodeMultivaluedFieldTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeMultivaluedFieldTest::setUp()
- 3.3.x tests/src/Functional/LingotekNodeMultivaluedFieldTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeMultivaluedFieldTest::setUp()
- 3.4.x tests/src/Functional/LingotekNodeMultivaluedFieldTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeMultivaluedFieldTest::setUp()
- 3.5.x tests/src/Functional/LingotekNodeMultivaluedFieldTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeMultivaluedFieldTest::setUp()
- 3.6.x tests/src/Functional/LingotekNodeMultivaluedFieldTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeMultivaluedFieldTest::setUp()
- 3.7.x tests/src/Functional/LingotekNodeMultivaluedFieldTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeMultivaluedFieldTest::setUp()
- 3.8.x tests/src/Functional/LingotekNodeMultivaluedFieldTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeMultivaluedFieldTest::setUp()
Overrides LingotekTestBase::setUp
File
- tests/
src/ Functional/ LingotekNodeMultivaluedFieldTest.php, line 35
Class
- LingotekNodeMultivaluedFieldTest
- Tests translating a node including multivalued fields.
Namespace
Drupal\Tests\lingotek\FunctionalCode
protected function setUp() : void {
parent::setUp();
// Place the actions and title block.
$this
->drupalPlaceBlock('local_tasks_block', [
'region' => 'header',
]);
$this
->drupalPlaceBlock('page_title_block', [
'region' => 'header',
]);
// Create Article node types.
$this
->drupalCreateContentType([
'type' => 'article',
'name' => 'Article',
]);
// Add a language.
ConfigurableLanguage::createFromLangcode('es')
->setThirdPartySetting('lingotek', 'locale', 'es_MX')
->save();
// Enable translation for the current entity type and ensure the change is
// picked up.
ContentLanguageSettings::loadByEntityTypeBundle('node', 'article')
->setLanguageAlterable(TRUE)
->save();
\Drupal::service('content_translation.manager')
->setEnabled('node', 'article', TRUE);
FieldStorageConfig::create([
'entity_type' => 'node',
'field_name' => 'foo',
'type' => 'text',
'cardinality' => FieldStorageConfig::CARDINALITY_UNLIMITED,
])
->save();
FieldConfig::create([
'entity_type' => 'node',
'bundle' => 'article',
'field_name' => 'foo',
'label' => "Foo field",
])
->save();
EntityFormDisplay::load('node.article.default')
->setComponent('foo', [
'type' => 'text_textfield',
])
->enable()
->save();
EntityViewDisplay::load('node.article.default')
->setComponent('foo', [
'type' => 'string',
'label' => 'above',
])
->enable()
->save();
drupal_static_reset();
\Drupal::entityTypeManager()
->clearCachedDefinitions();
$this
->applyEntityUpdates();
// Rebuild the container so that the new languages are picked up by services
// that hold a list of languages.
$this
->rebuildContainer();
$this
->saveLingotekContentTranslationSettings([
'node' => [
'article' => [
'profiles' => 'automatic',
'fields' => [
'title' => 1,
'body' => 1,
'foo' => 1,
],
],
],
]);
}