protected function LingotekNodeLayoutBuilderAsymmetricTranslationTest::setUp in Lingotek Translation 3.6.x
Same name and namespace in other branches
- 4.0.x tests/src/Functional/LingotekNodeLayoutBuilderAsymmetricTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeLayoutBuilderAsymmetricTranslationTest::setUp()
- 3.4.x tests/src/Functional/LingotekNodeLayoutBuilderAsymmetricTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeLayoutBuilderAsymmetricTranslationTest::setUp()
- 3.5.x tests/src/Functional/LingotekNodeLayoutBuilderAsymmetricTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeLayoutBuilderAsymmetricTranslationTest::setUp()
- 3.7.x tests/src/Functional/LingotekNodeLayoutBuilderAsymmetricTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeLayoutBuilderAsymmetricTranslationTest::setUp()
- 3.8.x tests/src/Functional/LingotekNodeLayoutBuilderAsymmetricTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeLayoutBuilderAsymmetricTranslationTest::setUp()
Overrides LingotekTestBase::setUp
1 call to LingotekNodeLayoutBuilderAsymmetricTranslationTest::setUp()
1 method overrides LingotekNodeLayoutBuilderAsymmetricTranslationTest::setUp()
File
- tests/
src/ Functional/ LingotekNodeLayoutBuilderAsymmetricTranslationTest.php, line 36
Class
- LingotekNodeLayoutBuilderAsymmetricTranslationTest
- Tests translating a node with multiple locales including paragraphs.
Namespace
Drupal\Tests\lingotek\FunctionalCode
protected function setUp() : void {
parent::setUp();
// Create Article node types.
$this
->drupalCreateContentType([
'type' => 'article',
'name' => 'Article',
]);
$bundle = BlockContentType::create([
'id' => 'custom_content_block',
'label' => 'Custom content block',
'revision' => FALSE,
]);
$bundle
->save();
block_content_add_body_field('custom_content_block');
// Place the actions and title block.
$this
->drupalPlaceBlock('page_title_block', [
'region' => 'content',
'weight' => -5,
]);
$this
->drupalPlaceBlock('local_tasks_block', [
'region' => 'content',
'weight' => -10,
]);
// Add locales.
ConfigurableLanguage::createFromLangcode('es')
->setThirdPartySetting('lingotek', 'locale', 'es_ES')
->save();
ConfigurableLanguage::createFromLangcode('es-ar')
->setThirdPartySetting('lingotek', 'locale', 'es_AR')
->save();
$this
->configureLayoutBuilder([
'article',
]);
// 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);
ContentLanguageSettings::loadByEntityTypeBundle('block_content', 'custom_content_block')
->setLanguageAlterable(TRUE)
->save();
\Drupal::service('content_translation.manager')
->setEnabled('block_content', 'custom_content_block', TRUE);
$edit['settings[node][article][fields][layout_builder__layout]'] = 1;
$this
->drupalPostForm('/admin/config/regional/content-language', $edit, 'Save configuration');
$this
->assertSession()
->responseContains('Settings successfully updated.');
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' => 'manual',
'fields' => [
'title' => 1,
'body' => 1,
'layout_builder__layout' => 1,
],
],
],
'block_content' => [
'custom_content_block' => [
'profiles' => 'manual',
'fields' => [
'body' => 1,
],
],
],
]);
}